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


Please Help Members By Posting Answers For Below Questions

Which header file is used for clrscr?

779


What are the types of pointers in c?

737


Is a house a shell structure?

906


How can I find out the size of a file, prior to reading it in?

879


What is c value paradox explain?

791


Write a code to remove duplicates in a string.

822


What is the difference between array_name and &array_name?

986


What are loops in c?

766


What is a program flowchart and explain how does it help in writing a program?

967


writ a program to compare using strcmp VIVA and viva with its output.

1768


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.

1696


Explain union.

899


Explain what is gets() function?

814


What is the advantage of using #define to declare a constant?

842


what is ur strangth & weekness

2034