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

Problem:Design and implement a class that allows a teacher to track the grades in a single ourse.Include methods that calculate the average grae, the highest grade, and the lowest grade.Wrute a program to testyour class implementation in a c#. given grades:integral=85, physics=87, datastruct=84.

1549


Box 1 cotain odd value X or Y the box 2 =X i.e 7 or 12 box 3= Y has value 19 if X is 7 or 31 if x is 12 get even value X or Y Use any operator steps allowed 3.

2537


why IT?

1486


hey guys.... My name is Bandana Thakur.Im a cse(8th sem) student.i want to make my career in php language.i want to work with google,wipro,tcs,infosys.peoples tell me that the salary package of php developer is very less n these companies do not work in php language.please tell me what i do now? should i go with the php language or make my career in another language? pls reply me in my e-mail id bandana.thakur14at@gmail.com

1606


what is the PID controller?

1653






what in 4th and 5th normal form ??

1677


what is difference between shell commands and shell scripting commands or both r same?

1626


What is the purpose of dampening roller

1262


how to send request to the direct server rather than proxy server

1486


c ka base kya hota hai? what is communication?

4733


why we use conio.h in c programming?

1679


what is the different between view and materialized view in oracle DBA?

1238


how can read number 1 to 100,without use anyloop.

1286


WHAT IS THE NAMESPACE FOR CUSTOMCONTROL AND USER CONTROL IN ASP.NET?

1668


anybody, Please send me the NIC(scientific officer/programmer) model questions papers to this mail id:imtiyazahamed14@gmail.com

1444