1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

how to print this using while statement??



1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 how to print this using while statement??..

Answer / divyesh

int i=1,j,k;
while(i<6)
{
k=((10-(2*i)))/2;
while(k>0)
{
printf(" ");
k--;
}
j=1;
while(j<=i)
{
printf("%d ",j);
j++;
}
printf("\n");
i++;
}

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Engineering AllOther Interview Questions

How would you design a gravity dam for holding back water?

0 Answers  


Why does the 'divisibility by 3' rule work?

0 Answers  


What is the mistake in the following program segment ? f() { int a; void c; f2(&c,&a);}

0 Answers   Geometric Software,


plz explain abt refrigeration r22 bitzer comprassors trouble shooting and maintenance

0 Answers  


iam from engineering information technology ... can i write group 1 exams??

0 Answers  






1 2 3 2 5 6 7 8 3 find the next term in the series

3 Answers   Virtusa,


what is the Relationship between quantity of Gas and capacity of AC machine in tonnage.

0 Answers   Zee,


What is the difference between "type testing" and "product qualification"?

0 Answers  


please explane me clusterd and non clusterd

0 Answers  


Tell me about your parents?? Pls share any one best words...

0 Answers   HGS, Hinduja,


What is Mointer in Operating System?

0 Answers  


My gre score is 283 and ielts is 5.5, will i get i20 for this score

0 Answers  


Categories
  • Civil Engineering Interview Questions Civil Engineering (5085)
  • Mechanical Engineering Interview Questions Mechanical Engineering (4452)
  • Electrical Engineering Interview Questions Electrical Engineering (16636)
  • Electronics Communications Interview Questions Electronics Communications (3918)
  • Chemical Engineering Interview Questions Chemical Engineering (1095)
  • Aeronautical Engineering Interview Questions Aeronautical Engineering (239)
  • Bio Engineering Interview Questions Bio Engineering (96)
  • Metallurgy Interview Questions Metallurgy (361)
  • Industrial Engineering Interview Questions Industrial Engineering (259)
  • Instrumentation Interview Questions Instrumentation (3014)
  • Automobile Engineering Interview Questions Automobile Engineering (332)
  • Mechatronics Engineering Interview Questions Mechatronics Engineering (97)
  • Marine Engineering Interview Questions Marine Engineering (124)
  • Power Plant Engineering Interview Questions Power Plant Engineering (172)
  • Textile Engineering Interview Questions Textile Engineering (575)
  • Production Engineering Interview Questions Production Engineering (25)
  • Satellite Systems Engineering Interview Questions Satellite Systems Engineering (106)
  • Engineering AllOther Interview Questions Engineering AllOther (1379)