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

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

3408


Write the fetch cycle and execute cycle for following instructions:JMPNZ (jump to the given address if the accumulator not equal to zero) RET(return from a subroutine) ADB (add the contents of register B to the accumulator and save result in the accumulator).

1771


4. What is your typical way of dealing with conflict?

1428


what are nanoemulsions and how are they prepared? i want a brief outline about nanoemulsions.. is anyone of you is having any literature, can you share that? also any an idea where i can get the information?

1550


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

1444






what's the difference between windows serevr 2003 or windows XP.

1649


what are the various technique used for inter process communication?

1642


what is the effect of low frequency(say 48Hz) on TUrbo- Generator set when running for a prolonged period?

1881


I am refused L1-B visa filed by my employer on May 09 by US consulate Chennai. When i am eligible to apply L1-B visa again through my employer?

1821


Define function ? Explain arguments in functions ?

1528


hi friends i am first time using this site.i came to by some tcs personals that certifications r important for placements.i am financially average i am learning java from books.please tell is it enough if not which certification should i go for

1335


what is the pri request of binary search

1272


what is buffer solution?

1652


hi, please send me "state bank of india", last 5 years question paper with answers to my mail id.

1614


what is difference between semaphre and deadlock

1686