Showing posts with label print patterns numbers. Show all posts
Showing posts with label print patterns numbers. Show all posts

Saturday, December 24, 2011

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