Number Pattern
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n,k;
clrscr();
printf("enter the range\n");
scanf("%d",&n);
k=n+1;
for(i=1;i<=n;i++)
{
for(j=1,k=k-i;j<=i;j++)
{
printf("%d",k);
k++;
}
printf("\n");
}
getch();
}
/*
output:-
-----------------
enter the range
5
5
45
345
2345
12345
*/
#include<conio.h>
void main()
{
int i,j,n,k;
clrscr();
printf("enter the range\n");
scanf("%d",&n);
k=n+1;
for(i=1;i<=n;i++)
{
for(j=1,k=k-i;j<=i;j++)
{
printf("%d",k);
k++;
}
printf("\n");
}
getch();
}
/*
output:-
-----------------
enter the range
5
5
45
345
2345
12345
*/
check this out
ReplyDeletehttp://cbasicprogram.blogspot.in/2012/04/number-patterns.html