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

how to print this using while statement??

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How to select the total numbers of fire extinguisher installed in a room ?

1492


How To Servers For Malitnationl Bank?

1423


how do we calculate physical address if logical address is given in the question?

2475


Modal vs Modaless in VB??

1509


what is the difference between error,exception,bug,defect,fault..?

1899






What is candidate key ? What is Alter net key ? & What is foreign key ?

1446


tell me the e book for data structure (basic)

1624


write a c++ program to interchange two-integer number without using the third variable. use concept of constructor overloading.

1783


how is the config take place and from reciever side how will process the data into internal table

1327


please send me latest Aptitude Test paper

1593


anyone send me aptitude and technical placement paper of Hewitt

1379


who is your role modal give in few sentances

1753


1)what to do in emergency situation of having total blackout (on a ship) 2)what to do in emergency situation of flooding in the engine room 3)under what conditions would engine room bilges be pumped overboard? 4)why is high pressure required for the injection of fuel into the cylinder of diesel engine. 5)why is doubled walled pipes employed for high pressure fuel lines? 6)reasons for overheating of main engine 7)how to detect choked fuel valve,leaky piston rings and their remedies during operation in diesel engine? 8)effects of insufficient or excessive cylinder lubrication? 9)causes of a diesel engine piston overheating.

3245


how the aeroplane protected from the lightening?

1678


How does Earthquake-proofing work?

640