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)
No comments:
Post a Comment