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

write a c program which accepts input as Anu.B.Kapoor and gives output as:Kapoor.A.B plz send me the ans

0 Answers   Boredbees,


what we have to say about hobbies,strong points,weak points

0 Answers   Banking,


why java take 2 byte for charecter???

1 Answers   MAHINDRA,


Write a program to count the no. of occurrence of word in given string Ex- Ram is good boy. Ram is doing good job. Ram – 2 is – 2 good – 2 boy – 1 doing –1 job – 1

0 Answers   Persistent,


What is the fallacy in the following program segment ? int *f1() { int a=5; return &a; } f() int *b=f1() int c=*b; }

1 Answers   Geometric Software,






T is a tree and V is a vertex of T of maximum degree in T, say the degree of V in n. Prove that T has atleast n vertices of degree 1.

0 Answers   TCS,


WHAT IS DIFFERENT BETWEEN YOU AND OTHER APPLICANT TO GIVE YOU THE JOB

0 Answers   ONGC,


what is dns?

0 Answers   Deshaw, HCL,


what are the various login options used in loadrunner tool to make a application performance testing

0 Answers  


If Neena says "Anita's father Raman is the only son of my father-in-law Mahipal",then how is bindu ,who is the sister of Anita,related to Mahipal

1 Answers  


What is the time complexity T(n) of the nested loops below? For simplicity, you may assume that n is a power of 2. That is, n = 2k for some positive integer k. : i = n; while (i >= 1){ j = i; while (j <= n) { <body of the inner while loop > // Needs &#61553;(1). j = 2 * j; } i = &#61675;i/2&#61691;; } :

2 Answers  


wat r aptitude ques askd in TCS??

1 Answers   TCS,


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