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 / reshma m.
int i,j,m;
m=2;
for(i=0;i<5;i++)
{putch('*');
putch('\n');
for(j=0;j<m;j++)
{putch('*');
m+=2;
}
putch('\n');
}
| Is This Answer Correct ? | 4 Yes | 5 No |
Post New Answer View All Answers
What is the use of getchar() function?
How can I recover the file name given an open stream?
What are dangling pointers? How are dangling pointers different from memory leaks?
what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above
What are the functions to open and close file in c language?
Do you know the use of 'auto' keyword?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
What is function pointer c?
What is a spanning Tree?
Explain how can I manipulate strings of multibyte characters?
What are register variables? What are the advantage of using register variables?
What is the basic structure of c?
What is int main () in c?
What is cohesion in c?
What are the benefits of organizational structure?