Numeric Patterns in C Program

*
* *
* * *
* * * *
* * * * *
#include<stdio.h>
main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("* ");
}
printf("\n");
}
}


1
22
333
4444
55555

#include<stdio.h>
main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",i);
}
printf("\n");
}
}


1
12
123
1234
12345

#include<stdio.h>
main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
}


* * * * *
* * * *
* * *
* *
*
#include<stdio.h>
main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j–)
{
printf("* ");
}
printf("\n");
}
}


11111
2222
333
44
5
#include<stdio.h>
main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j–)
{
printf("%d",i);
}
printf("\n");
}
}


54321
5432
543
54
5
#include<stdio.h>
main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j–)
{
printf("%d",j);
}
printf("\n");
}
}


12345
1234
123
12
1
#include<stdio.h>
main()
{
int i,j;
for(i=5;i>=1;i–)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
}


55555
4444
333
22
1
#include<stdio.h>
main()
{
int i,j;
for(i=5;i>=1;i–)
{
for(j=1;j<=i;j++)
{
printf("%d",i);
}
printf("\n");
}
}


1
3 5
7 9 11
13 15 17 19
21 23 25 27 29

#include<stdio.h>
main()
{
int i,j,a=1;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d ", a);
a=a+2;
}
printf("\n");
}
}


Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Captcha Here : *

Reload Image