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


Please Help Members By Posting Answers For Below Questions

What is c standard library?

694


Why should I prototype a function?

644


What's a good way to check for "close enough" floating-point equality?

630


what do the 'c' and 'v' in argc and argv stand for?

648


main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

915






Difference between malloc() and calloc() function?

658


What is data type long in c?

627


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...

1493


What is double pointer?

563


When should volatile modifier be used?

558


What is cohesion and coupling in c?

595


What is structure in c language?

625


FILE PROGRAMMING

1781


What is the heap in c?

647


What is the difference between NULL and NUL?

733