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
What is difference between structure and union in c programming?
write a program to print largest number of each row of a 2D array
What will be your course of action for a push operation?
Explain a file operation in C with an example.
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
How can I avoid the abort, retry, fail messages?
What are the 32 keywords in c?
Why use int main instead of void main?
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.?
What is variable in c example?
What are enums in c?
Can math operations be performed on a void pointer?
write a c program in such a way that if we enter the today date the output should be next day's date.
what is reason of your company position's in india no. 1.
What is the difference between constant pointer and constant variable?