Number Pattern 2
/*
To print the following pattern
1
3 5
7 9 11
*/
#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+2;
}
printf("\n");
}
getch();
}
/*
output :-
-----------
enter the range
3
1
3 5
7 9 11
*/
To print the following pattern
1
3 5
7 9 11
*/
#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+2;
}
printf("\n");
}
getch();
}
/*
output :-
-----------
enter the range
3
1
3 5
7 9 11
*/
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteC Program to print pattern
ReplyDeleteThis comment has been removed by the author.
ReplyDelete