Write a Program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
use two nested loops.
Answer Posted / umesh shinde
#include<stdio.h>
int 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("*");
printf("\n");
}
if(n%2!=0)
printf("\n*");
}
Is This Answer Correct ? | 8 Yes | 5 No |
Post New Answer View All Answers
Is c++ based on c?
Is that possible to add pointers to each other?
What is mean by data types in c?
Why do we use stdio h and conio h?
Why c is faster than c++?
Write program to remove duplicate in an array?
What is the total generic pointer type?
What does c mean in standard form?
What is output redirection?
What is wrong in this statement?
Here is a good puzzle: how do you write a program which produces its own source code as output?
Explain what is the benefit of using an enum rather than a #define constant?
What is pragma c?
What is static identifier?
How can you determine the maximum value that a numeric variable can hold?