Saturday, July 13, 2013

write a program to print following number pattern ?

1
23
456
78910
Program:
#include<stdio.h>
#include<conio.h>

void main()
{
   int r, p, k,h=1;
   clrscr();
   printf("\n enter the no of row");
   scanf("%d", &r);
   for ( k = 1 ; k <= 5 ; k++ )
   {
       for ( p =1; p <=k; p++,h++)
       printf("%d", h);

       printf("\n");
   }

   getch();
}

Output:
image



Like the Post? Do share with your Friends.

No comments:

Post a Comment