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)
printf("*\n");
else{
for(j=0;j<i;j++)
printf("*");
printf("\n");
}
}
return 0;
}

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the scope of static variable in c?

943


what is the function of pragma directive in c?

1060


Explain what is the advantage of a random access file?

1066


What is a macro in c preprocessor?

1050


What does the error 'Null Pointer Assignment' mean and what causes this error?

1153


When a c file is executed there are many files that are automatically opened what are they files?

1034


List some basic data types in c?

973


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

1325


What are the advantages of external class?

1002


#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }

1084


Which one would you prefer - a macro or a function?

1031


Why void is used in c?

948


Process by which one bit pattern in to another by bit wise operation is?

1096


Whats s or c mean?

949


What is pointer & why it is used?

1059