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
What is typedf?
What are the Advantages of using macro
What is the best way to comment out a section of code that contains comments?
What is "Duff's Device"?
The difference between printf and fprintf is ?
Explain what are binary trees?
ATM machine and railway reservation class/object diagram
Explain the use of #pragma exit?
Explain can the sizeof operator be used to tell the size of an array passed to a function?
Explain main function in c?
What is string concatenation in c?
What is break statement?
What is line in c preprocessor?
What does 3 mean in texting?
When is the “void” keyword used in a function?