/*
1
1 2
1 2 3
*/
#include<stdio.h>int main()
{
int i,j,n;
printf("Enter number: "); // To accept number from user
scanf("%d",&n);
{
int i,j,n;
printf("Enter number: "); // To accept number from user
scanf("%d",&n);
//outer for loop is used to print rows and the inner loop is used to print columns
for(i=1;i<=n;i++) //outer loop
{
for(j=1;j<=i;j++) //inner loop
{
printf("%d ",j);
}
printf("\n"); //for go to the next line
}
{
for(j=1;j<=i;j++) //inner loop
{
printf("%d ",j);
}
printf("\n"); //for go to the next line
}
return 0;
}
}
0 Comments