write a program to produce the following output;
ABCDEFGFEDCBA
ABCDEF FEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A

Answer Posted / amit kumar

#include<stdio.h>
#include<conio.h>
main()
{
int i,j,k,s;

for(i=71;i>=65;i--) //first half of sequence
{
for(j=65;j<=i;j++)
{
printf("%c",j);

}
for(s=1;s<((72-j)*2);s++) //for spaces between two trinangles
printf(" ");

for(k=i;k>=65;k--) //for second half of sequence
{
if(k==71)
continue;
printf("%c",k);
}
printf("\n");
}


getch();
return 0;
}

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between structure and union in c programming?

572


write a program to print largest number of each row of a 2D array

1874


What will be your course of action for a push operation?

669


Explain a file operation in C with an example.

665


pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

2204






How can I avoid the abort, retry, fail messages?

665


What are the 32 keywords in c?

639


Why use int main instead of void main?

601


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

632


What is variable in c example?

596


What are enums in c?

665


Can math operations be performed on a void pointer?

591


write a c program in such a way that if we enter the today date the output should be next day's date.

1685


what is reason of your company position's in india no. 1.

1779


What is the difference between constant pointer and constant variable?

750