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 |
Assume that the int variables i and j have been declared, and that n has been declared and initialized. Write code that causes a "triangle" of asterisks of size n to be output to the screen. Specifically, n lines should be printed out, the first consisting of a single asterisk, the second consisting of two asterisks, the third consistings of three, etc. The last line should consist of n asterisks. Thus, for example, if n has value 3, the output of your code should be * ** *** You should not output any space characters. Hint: Use a for loop nested inside another for loop.
what is macro in c? Difference between single linked list & double linked list what is fifo & lifo? what is stack & queue?
What is the code for following o/p * * * * * * * * * * * * * * * *
how tally is useful?
#include"stdio.h" #include"conio.h" void main() { int a; printf("\n enter a number:"); scanf("%c\n"); getch(); }
How to create a program that lists countries capitals when country is entered? (Terribly sorry, I'm a complete novist to coding with C, am looking for inspiration and general tips on how to code and create this program.)
To generate the series 1+3+5+7+... using C program
What are the different types of errors in C and when they occur?
difference between c/c++ programing language? what is necessesity of c++ when existing c programing language?
#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }
quoroum of computer languages?
write the value of x and y after execution of the statements: int x=19,y; y=x++ + ++x; x++; y++;