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
Do you know null pointer?
Write a program to implement queue.
Differentiate between functions getch() and getche().
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
Lists the benefits of c programming language?
Explain logical errors? Compare with syntax errors.
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .
Where can I get an ansi-compatible lint?
while initialization of array why we use a[][2] why not a[2][]...?
What are the scope of static variables?
How many types of functions are there in c?
What are the types of type qualifiers in c?
What is the difference between break and continue?