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


Please Help Members By Posting Answers For Below Questions

Which node is more powerful and can handle local information processing or graphics processing?

829


What is the purpose of macro in C language?

661


Does c have an equivalent to pascals with statement?

574


How will you declare an array of three function pointers where each function receives two ints and returns a float?

781


What is the difference between NULL and NUL?

728






What is an array in c?

595


How can I trap or ignore keyboard interrupts like control-c?

620


How can I use a preprocessorif expression to ?

601


Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

15048


What is the use of define in c?

597


What are the features of c languages?

628


When can you use a pointer with a function?

568


write an algorithm to display a square matrix.

2223


What does volatile do?

567


What does a pointer variable always consist of?

665