Sunday, 18 September 2016

Number Pattern 1, 2 4,1 3 5, 2 4 6 8, 1 3 5 7 9

1
2 4
1 3 5
2 4 6 8
1 3 5 7 9

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

No comments:

Post a Comment

Featured post

Country State City Database - MySQL / JSON Download

World Data Bundle — Full Continent, Country, State, City & Currency Dataset This article provides an overview of the  World Geo Data  di...