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


Please Help Members By Posting Answers For Below Questions

I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.

1907


How can you find the exact size of a data type in c?

601


What does return 1 means in c?

587


Can a variable be both static and volatile in c?

608


find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }

1857






Are enumerations really portable?

595


If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

3247


What is meant by type casting?

629


Is javascript based on c?

595


Mention four important string handling functions in c languages .

630


What is the meaning of typedef struct in c?

594


What are valid operations on pointers?

668


What is difference between && and & in c?

597


What are the general description for loop statement and available loop types in c?

687


What is I ++ in c programming?

626