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)
printf("*\n");
else{
for(j=0;j<i;j++)
printf("*");
printf("\n");
}
}
return 0;
}
Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
Which header file is used for clrscr?
What are the types of pointers in c?
Is a house a shell structure?
How can I find out the size of a file, prior to reading it in?
What is c value paradox explain?
Write a code to remove duplicates in a string.
What is the difference between array_name and &array_name?
What are loops in c?
What is a program flowchart and explain how does it help in writing a program?
writ a program to compare using strcmp VIVA and viva with its output.
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
Explain union.
Explain what is gets() function?
What is the advantage of using #define to declare a constant?
what is ur strangth & weekness