Write a Program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
use two nested loops.
Answer Posted / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
printf("enter the lines :");
scanf("%d",&n);
for(int i=1;i<=n/2;i++)
{
printf("*\n");
for(int j=1;j<=2*i;j++)
printf("*");
printf("\n");
}
if(n%2!=0)
printf("\n*");
getch();
}
| Is This Answer Correct ? | 29 Yes | 11 No |
Post New Answer View All Answers
What are formal parameters?
Where is c used?
What are c preprocessors?
What are control structures? What are the different types?
Write a program to find factorial of a number using recursive function.
What are the main characteristics of c language describe the structure of ac program?
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
Explain setjmp()?
Explain the ternary tree?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
Why static variable is used in c?
write a program to display all prime numbers
Explain what is the general form of a c program?
How can I call a function with an argument list built up at run time?
What is the difference between fread buffer() and fwrite buffer()?