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
Explain how do you use a pointer to a function?
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
Is there a way to switch on strings?
How pointers are declared?
Can a variable be both constant and volatile?
What is the right type to use for boolean values in c? Is there a standard type?
can we change the default calling convention in c if yes than how.........?
How many types of functions are there in c?
Why is structure padding done in c?
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
Can a pointer point to null?
Why doesnt the call scanf work?
Wt are the Buses in C Language
Are bit fields portable?
write a program to create a sparse matrix using dynamic memory allocation.