Skip to main content
C program to print number pattern 4
C program to print number pattern 4
1
1 2 3
1 2 3 4 5
#include<stdio.h>
int main()
{
int i,j,k=0;
for(i=0;i<3;i++)
{
printf("\n");
k=0;
for(j=0;j<5;j++)
{
if(j>=2-i && j<=2+i)
{
printf("%d ",++k);
}
else
printf(" ");
}
}
}
Output:
Comments
Post a Comment