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

Answer Posted / abdi

#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 ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between c and python?

586


explain what is an endless loop?

611


Describe how arrays can be passed to a user defined function

782


What do you mean by a local block?

632


What is main () in c?

588






What is the heap in c?

645


What does 3 mean in texting?

615


What is file in c language?

576


Differentiate call by value and call by reference?

569


What is volatile, register definition in C

691


hi send me sample aptitude papers of cts?

1654


What are the three constants used in c?

546


Differentiate between full, complete & perfect binary trees.

671


What is the difference between struct and typedef struct in c?

657


Explain about the constants which help in debugging?

855