write a program to produce the following output;
ABCDEFGFEDCBA
ABCDEF FEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
Answer Posted / soumili sen
#include<stdio.h>
int main()
{
int i,j;
for(i=7;i>=1;i--)
{
if(i==7)
{
for(j=1;j<=i;j++)
printf("%c",j+64);
for(j=i-1;j>=1;j--)
printf("%c",j+64);
}
else
{
for(j=1;j<=i;j++)
printf("%c",j+64);
for(j=6;j>=i;j--)
printf(" ");
for(j=5;j>=i;j--)
printf(" ");
for(j=i;j>=1;j--)
printf("%c",j+64);
}
printf("\n");
}
return 0;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Why string is used in c?
How can you access memory located at a certain address?
What are the restrictions of a modulus operator?
What is extern c used for?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
Differentiate fundamental data types and derived data types in C.
What is a struct c#?
What is the use of in c?
What are all different types of pointers in c?
What are pointers?
What is calloc in c?
What is the use of structure padding in c?
Why we write conio h in c?
what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above
How do you define a function?