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

What are inbuilt functions in c?

1038


What is ponter?

1269


Explain what does the format %10.2 mean when included in a printf statement?

1367


What is structure and union in c?

1153


int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;

1836


What do you mean by recursion in c?

1115


Is c dynamically typed?

1164


how do you execute a c program in unix.

1115


Explain how do you declare an array that will hold more than 64kb of data?

1455


What is graph in c?

1060


What is function pointer c?

1120


What is meant by gets in c?

1192


Can math operations be performed on a void pointer?

1054


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4694


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

1126