Friday, July 22, 2011

Program to print numbers in Traingular pattern {Type 12}


1
2  2
3  3  3
4  4  4  4
5  5  5  5  5
=====================================================
/*Serial No.4     [swami36.cpp]*/

#include<stdio.h>
#include<conio.h>
int main()
{clrscr();
int n,i,j,k=1;
printf("Enter values of n=") ;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
printf("%d",k);
printf("\n");
k++;
}
getch();
}

No comments:

Post a Comment

If you have any doubt, feel free to ask...