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
What is the difference between exit() and _exit() function in c?
I came across some code that puts a (void) cast before each call to printf. Why?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
What extern c means?
What does stand for?
Are negative numbers true in c?
What is the scope of local variable in c?
What is the use of c language in real life?
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
Linked lists -- can you tell me how to check whether a linked list is circular?
What is main () in c?
Can the “if” function be used in comparing strings?
what is a function method?give example?
How can you determine the maximum value that a numeric variable can hold?
What is the use of getchar functions?