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



write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD ..

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 ?    73 Yes 45 No

write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD ..

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

write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD ..

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

write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD ..

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

write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD ..

Answer / 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

write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD ..

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

write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD ..

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

write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD ..

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

write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD ..

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

write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD ..

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

Post New Answer

More C Interview Questions

What is the difference between %d and %i?

0 Answers  


main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??

19 Answers   EBS, Ramco, Sangwin, TCS,


What are the different properties of variable number of arguments?

0 Answers  


we have to use realloc only after malloc or calloc ? or we can use initially with out depending on whether we are using malloc or calloc in our program ?

2 Answers  


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

0 Answers  






What is the g value paradox?

0 Answers  


What type is sizeof?

0 Answers  


what is the difference between arrays and linked list

26 Answers   MAHINDRA, Tech Mahindra, Wipro,


struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer

0 Answers  


Which of the following about the C comments is incorrect ? a.commentscan go over multiple lines b.comments can start any where in the line c.a line can contain comments with out any language statements d.comments can occur within comments

6 Answers   TCS,


Write a program for finding factorial of a number.

0 Answers   Tech Mahindra,


What is meant by int main ()?

0 Answers  


Categories