Write a Program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
use two nested loops.
Answer Posted / adhiraj keshri
#include<stdio.h>
main()
{
int n;
printf("enter the lines");
scanf("%d",&n);
for(int i=1;i<=n/2;i++)
{
printf("*\n");
for(int j=1;j<=2*i;j++)
printf("*");
printf("\n");
}
if(n%2!=0)
printf("\n*");
}
| Is This Answer Correct ? | 4 Yes | 5 No |
Post New Answer View All Answers
When should I declare a function?
How do you use a 'Local Block'?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
What is difference between function overloading and operator overloading?
Can we use any name in place of argv and argc as command line arguments?
Whats s or c mean?
What is the use of f in c?
Why functions are used in c?
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
Write the control statements in C language
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
What is the size of array float a(10)?
write a c program to find the sum of five entered numbers using an array named number
What are pointers? What are stacks and queues?