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 / rfk

#include<stdio.h>
int main()
{
int n,i,j;
printf("enter the lines :");
scanf("%d",&n);
for(i=1;i<=n/2;i++)
{
printf("*\n");
for(j=1;j<=2*i;j++)
printf("*");
printf("\n");
}
if(n%2!=0)
printf("\n*");

}

compiled with GCC

Is This Answer Correct ?    13 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a list in c?

982


Explain what are the different file extensions involved when programming in c?

1051


Is null valid for pointers to functions?

1107


What is malloc() function?

1096


What is meant by type specifiers?

1082


What does the message "automatic aggregate intialization is an ansi feature" mean?

1142


Explain how do you search data in a data file using random access method?

1069


explain what are actual arguments?

1031


How can I rethow can I return a sequence of random numbers which dont repeat at all?

1147


What does the characters “r” and “w” mean when writing programs that will make use of files?

1421


How many types of sorting are there in c?

1010


What are the functions to open and close the file in c language?

985


What is pre-emptive data structure and explain it with example?

3654


Explain the difference between the local variable and global variable in c?

1024


What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?

1271