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
In which language linux is written?
How can a string be converted to a number?
Tell me when is a void pointer used?
What does typedef struct mean?
What is variable in c example?
How does placing some code lines between the comment symbol help in debugging the code?
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
Explain enumerated types in c language?
Explain the difference between null pointer and void pointer.
Explain what is operator promotion?
What is difference between union All statement and Union?
Is it better to bitshift a value than to multiply by 2?
Are pointers integers in c?
How can I open a file so that other programs can update it at the same time?
What is output redirection?