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...

how can i get output the following...
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1

and

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

plz plz...

Answer Posted / aditi

For first one:-
void main ()
{
for (int i= 5; i>= 1; i--)
{
for (int k=5; k >= 1; k--)
{
if (k> i)
printf(" ");
else
printf ("%d", k);
}
printf("\n");
}
}


For second:-
void main ()
{
int n = 0;

for (int i=1; i<6; i++)
{


for (int k=1; k <= i; k++)
{
n = n +1;
printf ("%d ", n);
}
printf("\n");
}
}

Is This Answer Correct ?    12 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an operator?

1131


Tell us two differences between new () and malloc ()?

1279


What is pivot in c?

1079


What's the total generic pointer type?

1109


What are the __date__ and __time__ preprocessor commands?

1181


Is it possible to initialize a variable at the time it was declared?

1260


Where are some collections of useful code fragments and examples?

1200


Does c have an equivalent to pascals with statement?

1070


What are the differences between Structures and Arrays?

1279


What is operator promotion?

1132


What are the features of c languages?

1144


What happens if header file is included twice?

1215


What is exit() function?

1075


Why c is procedure oriented?

1127


difference between Low, Middle, High Level languages in c ?

2144