Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Why is c still so popular?

1029


a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above

1099


How can I read a binary data file properly?

1144


Is malloc memset faster than calloc?

1049


What are the primitive data types in c?

1052


Is it better to use a macro or a function?

1146


What is the purpose of sprintf?

1118


What is strcpy() function?

1127


What is the use of clrscr?

1093


What is switch in c?

1069


What is optimization in c?

985


What are keywords in c with examples?

1073


What is restrict keyword in c?

1091


When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd

1043


What are the 5 types of inheritance in c ++?

1010