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 / gana
{
int a,b=2,i;
char *s="\0";
for(i=0;i<5;i++)
{
for(a=0;a<5-i;a++)
putch(' ');
for(a=0;a<b;a++)
putch('*');
b+=2;
puts(s);
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are the types of data files?
What does void main () mean?
Do variables need to be initialized?
How do you redirect a standard stream?
What are the disadvantages of a shell structure?
What are the 4 types of programming language?
What is the process to create increment and decrement stamen in c?
How many types of errors are there in c language? Explain
Explain what are header files and explain what are its uses in c programming?
Explain what is wrong in this statement?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
Can the “if” function be used in comparing strings?
What is c++ used for today?
How to declare a variable?
Explain what standard functions are available to manipulate strings?