i wish to print a pattern in C language like this:
2
2 3
3 4 5
4 5 6 7
5 6 7 8 9
i wrote this:
int main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
if(i>=j)
{
printf(" %d ",j+i-1);
}
}
printf("\n");
}
printf("\n");
}
i get output as :
1
2 3
3 4 5
4 5 6 7
5 6 7 8 9
how to start with '2' and '2 3'..?? please help!!! Thanks in advance!!
Aucun commentaire:
Enregistrer un commentaire