Twitter Feed Facebook Google Plus Youtube

Adsense responsive

Recent Post below header

Monday, 18 February 2013

C PROGRAM: TO PRINT TRIANGLE OF 12345...

CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,p,s;
clrscr();
for(i=1;i<=5;i++)
{
 p=i;
 for(s=1;s<=6-i;s++)
 {
  printf("   ");         /* three spaces */
 }
 for(j=1;j<=i;j++)
 {
  while(p>1)
  {
   printf("%3d",p);
   p--;
  }
  printf("%3d",j);
 }
printf("\n\n");
}
getch();
}


CODING

OUTPUT

For any query or suggestion please comment below...

No comments:

Post a Comment