write a program to produce the following output;
ABCDEFGFEDCBA
ABCDEF FEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
Answer Posted / super ali
#include<stdio.h>
02 main()
03 {
04 char z;
05 int j,i,k;
06 printf("Enter the number of rows..(1 to 26)\t");
07 scanf("%d",&k);
08 if(k<1||k>26)
09 {
10 printf("\nThe number entered was not in range of 1 to 26\n");
11 printf("exiting...\n");
12 exit(0);
13 }
14 printf("\n\n");
15 for (i=0;i<k;i++)
16 {
17 z = 'A';
18 for (j=0;j<k;j++)
19 {
20 if(j<k-i)
21 printf ("%c ",z);
22 else
23 printf("_ ");
24 z++;
25 }
26 z--;
27 for (j=k;j>0;j--)
28 {
29 if(j<=k-i)
30 printf ("%c ",z);
31 else
32 printf("_ ");
33 z--;
34 }
35 printf("\n\n");
36 }
37 }
----------------------------
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
What are the string functions? List some string functions available in c.
What is cohesion in c?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
Is struct oop?
What is queue in c?
Explain how do you override a defined macro?
Explain how do you convert strings to numbers in c?
Why we use int main and void main?
Why do we use namespace feature?
Hai what is the different types of versions and their differences
Why isn't any of this standardized in c? Any real program has to do some of these things.
Discuss the function of conditional operator, size of operator and comma operator with examples.
What do the functions atoi(), itoa() and gcvt() do?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software