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


Please Help Members By Posting Answers For Below Questions

Can a variable be both constant and volatile?

558


What is a pragma?

666


How many main () function we can have in a project?

612


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

2269


Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

2983






where are auto variables stored? What are the characteristics of an auto variable?

591


show how link list can be used to repersent the following polynomial i) 5x+2

1678


How to write a code for reverse of string without using string functions?

1578


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

1542


Explain the meaning of keyword 'extern' in a function declaration.

720


count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array

673


Explain how can I open a file so that other programs can update it at the same time?

590


What are variables c?

615


what do you mean by enumeration constant?

596


Explain what does it mean when a pointer is used in an if statement?

615