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

how could explain about job profile

0 Answers  


can we execute the program with the object file

1 Answers  


What is the difference between big endian form and little endian form? write a code to convert big endian form to little endian and vice versa..

5 Answers   Aricent, TCS,


Do you know the use of fflush() function?

0 Answers  


1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.

0 Answers  






main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); } wat is the o/p and how?

12 Answers   Tech Mahindra,


Write a program or provide a pseudo code to flip the 2nd bit of the 32 bit number ! (Phone Screen)

1 Answers   NetApp, PTU, Wipro,


Wt are the Buses in C Language

0 Answers   Infosys,


When should structures be passed by values or by references?

0 Answers   Adobe,


how to use enum datatype?Please explain me?

3 Answers   Excel,


What is the description for syntax errors?

0 Answers  


write a program in c to read array check element is present or not?

1 Answers  


Categories