write a program to produce the following output;
ABCDEFGFEDCBA
ABCDEF FEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
Answers were Sorted based on User's Feedback
Answer / balaji ganesh
main()
{
int i,n=65,m=72,f=0,s=-6;
clrscr();
while(m-->=n)
{s+=4;
for(i=n;i<m;i++)
printf("%c ",i);
if(f==0) ++m;
else
for(i=0;i<s;i++) printf(" ");
for(i=m-1;i>=n;i--)
printf("%c ",i);
printf("\n");f=1;
}
getch();
}
Is This Answer Correct ? | 72 Yes | 45 No |
Answer / guriya kumari
#include<stdio.h>
void main()
{
int i,j,k,l,m;
for(i=0;i<=6;i++)
{
for(k=65;k<=71-i;k++)
printf("%c",k);
for(j=1;j<=i*2-1;j++)
printf(" ");
for(l=71-i;l>=65;l--){
if(l==71)
continue;
printf("%c",l);}
printf("\n");
}
}
Is This Answer Correct ? | 26 Yes | 8 No |
Answer / vipandeep
#include<stdio.h>
main()
{
int i,j,k,x,n=-2;
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+4;
printf("\n");
}
getch();
}
Is This Answer Correct ? | 20 Yes | 4 No |
Answer / 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 |
#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 |
Answer / deepak shrimali
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,p,q;
clrscr();
q=-1;
for(i=71;i>=65;i--,q++)
{
for(j=65;j<=i;j++)
{
printf("%c",j);
}
if(i!=71)
{
for(p=0;p<2*q+1;p++)
{
printf(" ");
}
}
if(i==71)
{
k=i-1;
}
else
{
k=i;
}
for(;k>=65;k--)
{
printf("%c",k);
}
printf("\n");
}
getch();
}
Is This Answer Correct ? | 8 Yes | 4 No |
Answer / karthikeyan.cse ist year.skce
main()
{
int i,n=65,m=72,f=0,s=-6;
clrscr();
while(m-->=n)
{
s+=4;
for(i=n;i<m;i++)
{
printf("%c ",i);
}
}
if(f==0)
{ ++m;
}
else{
for(i=0;i<s;i++) printf(" ");
{
for(i=m-1;i>=n;i--)
{
printf("%c ",i);
}
}
printf("\n");f=1;
}
}
getch();
Is This Answer Correct ? | 11 Yes | 9 No |
Answer / soumili sen
#include<stdio.h>
int main()
{
int i,j;
for(i=7;i>=1;i--)
{
if(i==7)
{
for(j=1;j<=i;j++)
printf("%c",j+64);
for(j=i-1;j>=1;j--)
printf("%c",j+64);
}
else
{
for(j=1;j<=i;j++)
printf("%c",j+64);
for(j=6;j>=i;j--)
printf(" ");
for(j=5;j>=i;j--)
printf(" ");
for(j=i;j>=1;j--)
printf("%c",j+64);
}
printf("\n");
}
return 0;
}
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / vinay
main()
{
int i,n=65,m=72,f=0,s=-6;
while(m-->=n)
{s+=4;
for(i=n;i<m;i++)
printf("%c ",i);
if(f==0) ++m;
else
for(i=0;i<s;i++) printf(" ");
for(i=m-1;i>=n;i--)
printf("%c ",i);
printf("\n");f=1;
}
system("pause");
}
Is This Answer Correct ? | 7 Yes | 6 No |
Answer / super ali
#include<stdio.h>
02 main()
03 {
04 char z;
05 int j,i,k;
06 printf("Enter the number of rows..(1 to 26)\t");
07 scanf("%d",&k);
08 if(k<1||k>26)
09 {
10 printf("\nThe number entered was not in range of 1 to 26\n");
11 printf("exiting...\n");
12 exit(0);
13 }
14 printf("\n\n");
15 for (i=0;i<k;i++)
16 {
17 z = 'A';
18 for (j=0;j<k;j++)
19 {
20 if(j<k-i)
21 printf ("%c ",z);
22 else
23 printf("_ ");
24 z++;
25 }
26 z--;
27 for (j=k;j>0;j--)
28 {
29 if(j<=k-i)
30 printf ("%c ",z);
31 else
32 printf("_ ");
33 z--;
34 }
35 printf("\n\n");
36 }
37 }
----------------------------
Is This Answer Correct ? | 2 Yes | 2 No |
how to write a c program to print list of fruits in alpabetical order?
What is wild pointer in c?
What is volatile c?
what is the use of ‘auto’ keyword?
how would a 4*3 array A[4][3] stored in Row Major Order?
can anyone suggest some site name..where i can get some good data structure puzzles???
Toggle nth bit in a given integer - num
Explain what are the different file extensions involved when programming in c?
How to create struct variables?
Write a program which returns the first non repetitive character in the string?
WAP TO ACCEPT STRING AND COUNT A COMES N TIMES B COMES N TIMES C COMES N TIMES D COMES N TIMES AND SO ON......... AT LAST UNTIL Z COMES N TIMES...............
What is variable and explain rules to declare variable in c?