Laaysa with his friends going to the theatre for a movie. The seating arrangement is triangular in size. Theatre staffs insisted the audience to sit in odd row if the seat number is odd and in even row if the seat number is even.But the instruction is very confusing for Laaysa and his friends.So help them with the seating layout so that they can sit in correct seats.
#include<stdio.h>
int main()
{int t,i,j,c;
scanf("%d",&t);
for(i=1;i<=t;i++){
if(i%2==0)
c=2;
else
c=1;
for(j=1;j<=i;j++){
printf("%d ",c);
c+=2;
}printf("\n");
} return 0;}
Comments
Post a Comment