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


Please Help Members By Posting Answers For Below Questions

Is c++ based on c?

652


Is that possible to add pointers to each other?

901


What is mean by data types in c?

551


Why do we use stdio h and conio h?

639


Why c is faster than c++?

632






Write program to remove duplicate in an array?

600


What is the total generic pointer type?

728


What does c mean in standard form?

598


What is output redirection?

692


What is wrong in this statement?

606


Here is a good puzzle: how do you write a program which produces its own source code as output?

599


Explain what is the benefit of using an enum rather than a #define constant?

722


What is pragma c?

613


What is static identifier?

704


How can you determine the maximum value that a numeric variable can hold?

640