write a program to produce the following output;
ABCDEFGFEDCBA
ABCDEF FEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
Answer Posted / sanchita sengupta
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,k,x,n=-1;
i=71;
while(i>=65)
{
for(j=65;j<=i;j++)
{
printf("%c",j);
}
if(i!=71)
{
for(x=1;x<=n;x++)
{
printf(" ");
}
}
for(k=i;k>=65;k--)
{
if(k==71)
continue;
printf("%c",k);
}
i--;
n=n+2;
printf("\n");
}
getch();
}
| Is This Answer Correct ? | 10 Yes | 4 No |
Post New Answer View All Answers
What is malloc calloc and realloc in c?
What are the primitive data types in c?
How do I create a directory? How do I remove a directory (and its contents)?
What is the usage of the pointer in c?
What are the rules for the identifier?
Explain what is wrong with this statement? Myname = ?robin?;
Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?
how can I convert a string to a number?
Compare interpreters and compilers.
What are the benefits of c language?
How can I change their mode to binary?
What is structure padding and packing in c?
Explain what are multidimensional arrays?
What is FIFO?
Which is better pointer or array?