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

What is the reason of hunting of variable turbine geometry?

2 Answers  


why do you want to join tcs

0 Answers   TCS,


URGENT.. I want to make a really good project using ADVANCE JAVA Can anyone suggest any great n innovative ideas I have nearly 4 months to make it so it can be big n time consuming... It should be Web Based also... It can use more than one Java Technologies.. Please suggest me something innovative n great.. thanks:

1 Answers  


how am i supposed to convert a class program in C++ to Matlab? Do i also need to make classes in matlab too or I can do it without making classes???Can somebody help....

0 Answers  


Describe an impedance matching circuit?

2 Answers  






what are the no. of leaf nodes in a fibonacci tree ?

0 Answers  


i want to section engineer(signal) question paper......plz tell me how i get

0 Answers  


is there increase in the pressure of water or the density of water if we go deep into the ocean.(but the density of water is 1000kg/cubic meter)?

1 Answers  


what are the under ground metods praticed in indian copper mines

1 Answers   HCL,


A rectangular plank (2)1/2 meters wide can be placed so that it is on either side of the diagonal of a square shown below.(Figure is not available) What is the area of the plank?

1 Answers   Google, Mu Sigma,


#include<stdio.h> int fn(int v); main() { printf("%d\n",fn(7)); } int fn(int v) { if(v==1 || v==0) return 1; if(v%2==0) return fn(v/2)+2; else return fn(v-1)+3; }

0 Answers  


what is typa casting and type conversion ?

0 Answers  


Categories
  • Civil Engineering Interview Questions Civil Engineering (5085)
  • Mechanical Engineering Interview Questions Mechanical Engineering (4452)
  • Electrical Engineering Interview Questions Electrical Engineering (16638)
  • 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)