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


Please Help Members By Posting Answers For Below Questions

The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

634


What are the disadvantages of a shell structure?

695


Write a program to identify if a given binary tree is balanced or not.

684


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.?

628


What are the different types of linkage exist in c?

613






#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); }

720


Write a program on swapping (100, 50)

638


What are the types of functions in c?

572


Why is structure padding done in c?

645


What are loops in c?

551


How can you check to see whether a symbol is defined?

592


How can type-insensitive macros be created?

701


What is #line?

611


What is array of structure in c?

594


What is the use of extern in c?

647