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)
{
putchar('*');
putchar('\n');
}
else{
for(j=0;j<i;j++)
putchar('*');
putchar('\n');
}
}
return 0;
}
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
Can one function call another?
Explain indirection?
What is the difference between typedef struct and struct?
What is %d used for?
What is the best organizational structure?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
What are the uses of null pointers?
Why do we need functions in c?
What does malloc () calloc () realloc () free () do?
Explain how do you print an address?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
Is c compiled or interpreted?
hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel
in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above
What is the meaning of 2d in c?