Write a Program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
use two nested loops.
Answer Posted / vignesh1988i
#include<stdio.h>
#include<conio.h>
void 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("%d",j);
printf("\n");
}
if(n%2!=0)
printf("\n*");
getch();
}
thank u
Is This Answer Correct ? | 54 Yes | 29 No |
Post New Answer View All Answers
The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration
What are the disadvantages of a shell structure?
Write a program to identify if a given binary tree is balanced or not.
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?
What are the different types of linkage exist in c?
#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }
Write a program on swapping (100, 50)
What are the types of functions in c?
Why is structure padding done in c?
What are loops in c?
How can you check to see whether a symbol is defined?
How can type-insensitive macros be created?
What is #line?
What is array of structure in c?
What is the use of extern in c?