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

Using string functions write a program that will accept the name of the capital as input value and will display the corresponding country. ------------------------ Capitals Countries ------------------------ Capitals Countries Ottawa Canada Moscow Russia Rome Italy I can't not get it to run properly

1 Answers   AMA,


what is exceptions?

5 Answers   HCL, Wipro,


errors are known as?

3 Answers   EX, State Bank Of India SBI,


How to convert hexadecimal to binary using c language..

1 Answers   Bajaj, GAIL, Satyam, Zenqa,


what is syntax error?

3 Answers  






who was the present cheif governor of reserve bank of india

6 Answers   State Bank Of India SBI,


how to convert decimal to hexadecimal without using arrays just loops

2 Answers  


Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has already been declared, use a do...while loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j .

2 Answers  


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

6 Answers   HCL,


quoroum of computer languages?

0 Answers   Infosys,


WHAT WILL BE THE OUTPUT OF THE FOLLOWING QUESTION void main() { int x=4,y=3,z; z=x-- -y; printf("%d%d%d",x,y,z); }

25 Answers   HCL,


Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;

3 Answers  


Categories