write a program to produce the following output;
ABCDEFGFEDCBA
ABCDEF FEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
Answer Posted / ravinder singh
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n = 1;
for(char i=71; i>=65; i--)
{
for(char j=65;j<=i; j++)
{
cout<<j;
}
if(i!=71)
{
for(int x=2; x<n; x++)
{
cout<<" ";
}
}
if(i==71)
{
for(char k=i-1; k>=65;k--)
{
// if(k==71)
// continue;
cout<<k;
}
}
else if(i==70||i==69||i==68||i==67||i==66||i==65)
{
for(char k=i; k>=65;k--)
{
cout<<k;
}
}
n = n+2;
cout<<"\n";
}
getch();
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Is Exception handling possible in c language?
What the advantages of using Unions?
Explain the difference between malloc() and calloc() function?
Do you know the use of fflush() function?
What is meant by type specifiers?
What is the difference between malloc() and calloc()?
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
What is #include cctype?
What are structure types in C?
What is pragma c?
What is a nested loop?
Define recursion in c.
How can I find out how much free space is available on disk?
Why string is used in c?
What are the advantage of c language?