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

how to build a exercise findig min number of e heap with list imlemented?

2035


What is the condition that is applied with ?: Operator?

1088


What are identifiers c?

1030


Where local variables are stored in c?

970


How to establish connection with oracle database software from c language?

2161


Do you know the use of 'auto' keyword?

1145


Are pointers integers in c?

1039


Why static variable is used in c?

998


What are the different data types in C?

1163


Is there a way to compare two structure variables?

1079


What is %lu in c?

1198


I have seen function declarations that look like this

1004


How pointers are declared?

921


Explain output of printf("Hello World"-'A'+'B'); ?

1453


What is bash c?

965