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 are c preprocessors?
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
What is the basic structure of c?
What are the different types of data structures in c?
What language is windows 1.0 written?
What is the c value paradox and how is it explained?
When should the const modifier be used?
how to construct a simulator keeping the logical boolean gates in c
What is volatile variable how do you declare it?
Explain Function Pointer?
How variables are declared in c?
Explain 'far' and 'near' pointers in c.
What is the usage of the pointer in c?
What are the types of pointers in c?
What does c mean in basketball?