Friday, March 9, 2012

Program to print the triangle of no.

// Program to calculate the triangle of no.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
#include<stdio.h>
#include<conio.h>
main()
{
       int x,i;
       for(x=1;x<=5;x++)
       {
          for(i=1;i<=x;i++)
         {
                          printf("  %d",i);
          }
                          printf("\n\n");
       }
 getch();
   }

No comments:

Post a Comment