Number Pattern 3

/*

To print the following number pattern
1
2 3
4 5 6
7 8 9 10

*/

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n,a=1;
clrscr();
printf("enter the range\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d ",a);
a=a+1;
}
printf("\n");
}
getch();
}

/*
output :-
------------
enter the range
4

1
2 3
4 5 6
7 8 9 10

*/

Comments

  1. check this out
    http://cbasicprogram.blogspot.in/2012/04/number-patterns.html

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete

Post a Comment