1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 . . . n #include(stdio.h) // note place '<' & '>' in place of '(' & ')' #include(conio.h) int main( ) { int r,c,n,sp; clrscr( ); printf("Enter the no. of rows u want to print:"); scanf("%d", &n); for(r=1; r<=n; r++) { for(sp=n; sp>=r; sp--) printf(" "); // give one space in betw quotations. for(c=1; c<=r; c++) printf("%2d", c); printf("\n"); } getch( ); return 0; } |
Tuesday, November 10, 2009
Write a C program to print the Given pyramid
Subscribe to:
Post Comments (Atom)
write a progam in c language to print
ReplyDeleteA B C D E F G F E D C B A
A B C D E F F E D C B A
A B C D E E D C B A
A B C D D C B A
A B C C B A
A B B A
A A
DeleteWrite a C program to print the Given pyramid
► October (9)
► August (1)
► July (10)
► June (3)
► May (1)
► February (15)
► January (16)
FOLLOWERS
SUBSCRIBE NOW: IHEART
I heart FeedBurner
SUBSCRIBE
RSS Feed (xml)
Tuesday, November 10, 2009
Write a C program to print the Given pyramid
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
.
.
.
n
#include(stdio.h) // note place '<' & '>' in place of '(' & ')'
#include(conio.h)
int main( )
{
int r,c,n,sp;
clrscr( );
printf("Enter the no. of rows u want to print:");
scanf("%d", &n);
for(r=1; r<=n; r++)
{
for(sp=n; sp>=r; sp--)
printf(" "); // give one space in betw quotations.
for(c=1; c<=r; c++)
printf("%2d", c);
printf("\n");
}
getch( );
return 0;
write a progam in c language to print
ReplyDeleteA B C D E F G F E D C B A
A B C D E F F E D C B A
A B C D E E D C B A
A B C D D C B A
A B C C B A
A B B A
A A
A B C D E F G F E D C B A
ReplyDeleteA B C D E F F E D C B A
A B C D E E D C B A
A B C D D C B A
A B C C B A
A B B A
A A
ABCDEFGFEDCBA
ReplyDeleteABCDEF FEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
This comment has been removed by the author.
ReplyDeletewrite a prog :~
ReplyDeleteA
BB
CCC
DDDD
EEEEE
FFFFFF
GGGGGGG
HHHHHHHH
IIIIIIIII
JJJJJJJJJJ
KKKKKKKKKKK
LLLLLLLLLLLL
MMMMMMMMMMMMM
NNNNNNNNNNNNNN
OOOOOOOOOOOOOOO
PPPPPPPPPPPPPPPP
QQQQQQQQQQQQQQQQQ
RRRRRRRRRRRRRRRRRR
SSSSSSSSSSSSSSSSSSS
TTTTTTTTTTTTTTTTTTTT
UUUUUUUUUUUUUUUUUUUUU
VVVVVVVVVVVVVVVVVVVVVV
WWWWWWWWWWWWWWWWWWWWWWW
XXXXXXXXXXXXXXXXXXXXXXXX
YYYYYYYYYYYYYYYYYYYYYYYYY
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
Hi,
ReplyDeleteCan u pls tell me the program for this kind of output:
ABCDEFEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
sorry i meant to say this output:
ReplyDeleteABCDEFEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
ABCDEFEDCBA
ReplyDeleteABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
plz give c code for this
PLS GIVE C CODE FOR THIS OUTPUT
ReplyDeleteA B C C B A
A B B A
A A
A B B A
A B C C B A
A B C C B A
ReplyDeleteA B B A
A A
A B B A
A B C C B A