What is the code for following o/p
*
* *
* *
* *
* *
* *
* *
* *
*



What is the code for following o/p * * * * * * * * * * * ..

Answer / unknown

#include<stdio.h>

void main()
{
int i,j,k,num = 5;

for(i = num;i > 0;i--){
for(j = 1;j <= i;j++){
printf(" ");
}
for(k = (j - 1);k < num;k++){
if(k==j-1 || k==num-1)
printf("*");
else
printf(" ");
printf(" ");
}
printf(" \n");
}


for(i = num;i > 0;i--){
for(j = (num - i);j > 0;j--){
printf(" ");
}
for(k = 0;k < i;k++){
if(k==0|| k==i-1)
printf("*");
else
printf(" ");
printf(" ");
}
printf(" \n");
}
}

Is This Answer Correct ?    6 Yes 1 No

Post New Answer

More C C++ Errors Interview Questions

who was the present cheif governor of reserve bank of india

6 Answers   State Bank Of India SBI,


void main() { int i=7; printf("N= %*d",i,i); }

6 Answers   HCL,


How to convert hexadecimal to binary using c language..

1 Answers   Bajaj, GAIL, Satyam, Zenqa,


full c programming error question based problem

3 Answers   HCL, TCS,


void main() { int i=5; printf("%d",i+++++i); }

14 Answers   HCL,






I'm having trouble with coming up with the correct code. Thank You!! The assignment was to write a program using string functions that accepts a price of an item and displays its coded value. The base of the keys: X C O M P U T E R S 0 1 2 3 4 5 6 7 8 9 Sample I/O Dialogue: Enter Price: 489.50 Coded Value: PRS.UX

0 Answers  


Display this kind of output on screen. 1 0 1 1 0 1 3. Display this kind of output on screen. 1 1 0 1 0 1 4. Display this kind of output on screen. 1 1 0 1 0 1 5.Display this kind of output on screen. 1 2 3 4 5 6 7 8 9 10

1 Answers  


what is syntax error?

3 Answers  


how to convert decimal to hexadecimal without using arrays just loops

2 Answers  


write the value of x and y after execution of the statements: int x=19,y; y=x++ + ++x; x++; y++;

0 Answers  


wap for bubble sort

3 Answers  


which typw of errors ? & how to solve it ?

0 Answers  


Categories