Write a Program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
use two nested loops.

Answer Posted / prasanna

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j;
printf("enter the lines:");
scanf("%d",&n);
for(i=1;i<=n/2;i++)
{
printf("/n");
for(j=1;j<=2*i;j++)
printf("\n");
}
if(n%2!=0);
printf("\n");
getch();
}

Is This Answer Correct ?    10 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is typedf?

670


What are the Advantages of using macro

688


What is the best way to comment out a section of code that contains comments?

783


What is "Duff's Device"?

703


The difference between printf and fprintf is ?

720






Explain what are binary trees?

613


ATM machine and railway reservation class/object diagram

4805


Explain the use of #pragma exit?

699


Explain can the sizeof operator be used to tell the size of an array passed to a function?

597


Explain main function in c?

626


What is string concatenation in c?

568


What is break statement?

631


What is line in c preprocessor?

614


What does 3 mean in texting?

615


When is the “void” keyword used in a function?

837