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

print the following using nested for loop.
5 4 3 2 1
1 2 3 4
3 2 1
1 2
1
2 1
1 2 3
4 3 2 1
1 2 3 4 5

Answer Posted / anand.dayalan@gmail.com

#include<stdio.h>
#include<conio.h>

void main()
{
for(int i=1; i<=2; i++)
for(int j=(i==1)?1:2;j<=5;j++)
{
for(int k = (j%2==1 && i==1)? 5 + 1 -j: (j%2==0 && i==2)?
j:1; (j%2==1 && i==1)? k>=1: (j%2==0 && i==2)? k>=1:(j%2==0
&& i==1)?k<=5 + 1 -j:k<=j ;(j%2==1 && i==1)? k--: (j%2==0 &&
i==2)? k--:k++)
printf("%d", k);
printf("\n");
}
}

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use pointer to pointer in c?

1021


What does %d do in c?

911


What do you mean by keywords in c?

1083


Differentiate between full, complete & perfect binary trees.

1052


number of times a digit is present in a number

1988


Why use int main instead of void main?

1072


Why is c called c not d or e?

1048


What is dynamic variable in c?

986


How many levels deep can include files be nested?

1099


What is the use of sizeof () in c?

993


What is difference between array and pointer in c?

1027


In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

2058


What is operator precedence?

1150


What are the 4 types of organizational structures?

1031


What are the data types present in c?

1091