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 ?    72 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

. Consider the following program main() { int a[5]={1,3,6,7,0}; int *b; b=&a[2]; } The value of b[-1] is (A) 1 (B) 3 (C) -6 (D) none

9 Answers   Oracle,


how does the C compiler interpret the following two statements p=p+x; q=q+y; a.p=p+x; q=q+y b.p=p+xq=q+y c.p=p+xq; q=q+y d.p=p+x/q=q+y

4 Answers   TCS,


Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings

0 Answers  


int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); what is the o/p?

6 Answers   Verifone,


Explain how can I read and write comma-delimited text?

0 Answers  






WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1 Answers   IBM,


write a program for fibonaci series by using while loop in c?

2 Answers  


identify the in correct expression a.a=b=3=4; b.a=b=c=d=0; float a=int b=3.5; d.int a; float b; a=b=3.5;

8 Answers   TCS,


The operation of a stair case switch best explains the a) or operation b) and operation c)exclusive nor operation d)exclusive or operation Which of the following is/are syntactically correct? a) for(); b) for(;); c) for(,); d) for(;;);

1 Answers   HCL, Public Service Commission,


How to write the code of the program to swap two numbers with in one statement?

2 Answers  


code for selection sort?

1 Answers  


Are the variables argc and argv are local to main?

0 Answers   TISL,


Categories