Write a program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
Don't use printf statements;use two nested loops instead.
you will have to use braces around the body of the outer
loop if it contains multiple statements.
Answer Posted / rakesh
#include<stdio.h>
int main()
{
int i,j;
for(i=1;i<=10;i++){
if(i%2!=0)
printf("*\n");
else{
for(j=0;j<i;j++)
printf("*");
printf("\n");
}
}
return 0;
}
Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
What is c standard library?
Why should I prototype a function?
What's a good way to check for "close enough" floating-point equality?
what do the 'c' and 'v' in argc and argv stand for?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
Difference between malloc() and calloc() function?
What is data type long in c?
write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...
What is double pointer?
When should volatile modifier be used?
What is cohesion and coupling in c?
What is structure in c language?
FILE PROGRAMMING
What is the heap in c?
What is the difference between NULL and NUL?