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
Which node is more powerful and can handle local information processing or graphics processing?
What is the purpose of macro in C language?
Does c have an equivalent to pascals with statement?
How will you declare an array of three function pointers where each function receives two ints and returns a float?
What is the difference between NULL and NUL?
What is an array in c?
How can I trap or ignore keyboard interrupts like control-c?
How can I use a preprocessorif expression to ?
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10
What is the use of define in c?
What are the features of c languages?
When can you use a pointer with a function?
write an algorithm to display a square matrix.
What does volatile do?
What does a pointer variable always consist of?