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


Please Help Members By Posting Answers For Below Questions

Explain how do you use a pointer to a function?

642


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.

1600


Is there a way to switch on strings?

623


How pointers are declared?

567


Can a variable be both constant and volatile?

564






What is the right type to use for boolean values in c? Is there a standard type?

568


can we change the default calling convention in c if yes than how.........?

2037


How many types of functions are there in c?

587


Why is structure padding done in c?

653


the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above

726


Can a pointer point to null?

594


Why doesnt the call scanf work?

679


Wt are the Buses in C Language

2754


Are bit fields portable?

681


write a program to create a sparse matrix using dynamic memory allocation.

4375