C Program to Print Patterns of Numbers

It is a sample c program to print patterns of numbers.

Program Source Code


#include"stdio.h"
#include"conio.h"
void main()
{
int i,j,n,k;
printf (“Enter the value of n”);
scanf(“%d”,&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n-1;j++)
{
printf(“ ”);
}
for(k=1;k<=i;k++)
{
printf(“1”);
}
printf(“\n”);
}
getch();
}

Output


Print Patterns of Numbers

Post a Comment

3 Comments
RIYA said…
i need a program to print
12
123
1234
12345
khan said…
This comment has been removed by the author.
khan said…
i need a program to print these numbers in triangle pattern
1
2 3
4 5 6
7 8 9 10