Write a Program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
use two nested loops.
Answer Posted / rfk
#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*");
}
compiled with GCC
Is This Answer Correct ? | 13 Yes | 7 No |
Post New Answer View All Answers
what is different between auto and local static? why should we use local static?
What is the difference between #include
What is the use of extern in c?
Why is extern used in c?
Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)
How does selection sort work in c?
There seem to be a few missing operators ..
Do you know the use of 'auto' keyword?
Stimulate calculator using Switch-case-default statement for two numbers
Is javascript based on c?
Write a progarm to find the length of string using switch case?
What is the full form of getch?
What is difference between structure and union in c?
What is else if ladder?
Is it acceptable to declare/define a variable in a c header?