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 difference between structure and union with example?

989


What is a void * in c?

1021


What is 02d in c?

1028


How can you draw circles in C?

1099


What is the use of c language in real life?

972


What is scope of variable in c?

991


What standard functions are available to manipulate strings?

1075


What is the advantage of using #define to declare a constant?

1037


how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions

3129


What is volatile keyword in c?

997


What are the applications of c language?

1012


What is static memory allocation? Explain

1033


Who developed c language?

1039


Do pointers need to be initialized?

1018


What is pass by value in c?

1005