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 are c preprocessors?

672


printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

632


What is the basic structure of c?

551


What are the different types of data structures in c?

595


What language is windows 1.0 written?

571






What is the c value paradox and how is it explained?

569


When should the const modifier be used?

652


how to construct a simulator keeping the logical boolean gates in c

1722


What is volatile variable how do you declare it?

562


Explain Function Pointer?

681


How variables are declared in c?

567


Explain 'far' and 'near' pointers in c.

700


What is the usage of the pointer in c?

598


What are the types of pointers in c?

526


What does c mean in basketball?

559