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:
*
**
*
****
*
******
*
********
*
**********
Don't use printf statements;use two nested loops instead.
you will have to use braces around the body of the outer
loop if it contains multiple statements.

Answer Posted / rakesh

#include<stdio.h>
int main()
{
int i,j;
for(i=1;i<=10;i++){
if(i%2!=0)
{
putchar('*');
putchar('\n');
}
else{
for(j=0;j<i;j++)
putchar('*');
putchar('\n');
}
}
return 0;
}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a pointer point to null?

1019


When do we get logical errors?

1069


What is printf () in c?

1011


What is difference between function overloading and operator overloading?

1044


Can main () be called recursively?

1060


Multiply an Integer Number by 2 Without Using Multiplication Operator

721


What is structure and union in c?

1069


What is a MAC Address?

1004


What is the difference between abs() and fabs() functions?

1059


Which node is more powerful and can handle local information processing or graphics processing?

1256


What is console in c language?

1041


Why does not c have an exponentiation operator?

997


Write a program to find the biggest number of three numbers in c?

1004


What is the use of gets and puts?

969


What is array in C

1099