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

4. main() { int c=- -2; printf("c=%d",c); }

1364


Why header file is used in c?

571


what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9

1426


please send me the code for multiplying sparse matrix using c

1718


What is adt in c programming?

607






Explain what will be the outcome of the following conditional statement if the value of variable s is 10?

738


Why is not a pointer null after calling free?

587


typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

1066


What does the file stdio.h contain?

597


Explain how can I manipulate strings of multibyte characters?

773


What is difference between structure and union in c?

539


What does do in c?

601


What are types of preprocessor in c?

613


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1314


How do you list files in a directory?

559