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
What are inbuilt functions in c?
What is ponter?
Explain what does the format %10.2 mean when included in a printf statement?
What is structure and union in c?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
What do you mean by recursion in c?
Is c dynamically typed?
how do you execute a c program in unix.
Explain how do you declare an array that will hold more than 64kb of data?
What is graph in c?
What is function pointer c?
What is meant by gets in c?
Can math operations be performed on a void pointer?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above