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


Please Help Members By Posting Answers For Below Questions

Is it possible to execute code even after the program exits the main() function?

821


What are the advantages of Macro over function?

1209


What are the different types of objects used in c?

579


What is array in C

713


what is a constant pointer in C

682






What is the difference between int main and void main in c?

595


Do you know null pointer?

616


What is .obj file in c?

650


How does placing some code lines between the comment symbol help in debugging the code?

550


What is array in c with example?

619


Write a program to reverse a given number in c language?

623


How can I implement sets or arrays of bits?

609


What are the primitive data types in c?

579


Tell me what is null pointer in c?

617


explain how do you use macro?

669