Brijmohan lal Sahu - Facebook
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, December 11, 2014

Program to print number pattern square box by for loop in C. (Pattern 2)


Number Pattern


Code Box
------------------------------------

/*program to print star pattern square box by for loop

  1
  12
  123
  1234
  12345

*/

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j;
i=1;
clrscr();

printf("\nEnter a number: ");
scanf("%d",&n);

for(i=1;i<=n;i++)
{
        for(j=1;j<=i;j++)
        {
        printf("%d",j);
        }

printf("\n");

}
getch();
}



No comments: