‘C’ program to display n lines of the pattern.
C File =>
/* Write a ‘C’ program to display n lines of the following pattern.
1
2 3
4 5 6 */
#include<stdio.h>
int main()
{
int i,j,n=1;
for(i=1;i<4;i++)
{
for(j=1;j<=i;j++)
{
printf("%d\t",n);
n++;
}
printf("\n");
}
return 0;
}
Comments
Post a Comment
Please do not enter any spam link in message.