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

Program to find larger of the two numbers without using if-else,while,for,switch

Answer Posted / gokul prajapat

void main()
{
int a,b,max;
printf("Enter two values : ");
scanf("%d%d");
max=(a>b)*a + (a<b)*b;
printf("\nmaximum value : %d",max);
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to print "hello world" without using a semicolon?

1025


Which control loop is recommended if you have to execute set of statements for fixed number of times?

1311


Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].

1066


How can I list all of the predefined identifiers?

946


What is signed and unsigned?

1025


How many types of operators are there in c?

1000


Differentiate call by value and call by reference?

928


Explain how can I read and write comma-delimited text?

1131


Difference between Shallow copy and Deep copy?

1980


What is a const pointer?

1058


writ a program to compare using strcmp VIVA and viva with its output.

1995


How can you allocate arrays or structures bigger than 64K?

1095


What functions are used in dynamic memory allocation in c?

1035


#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }

1144


How is a macro different from a function?

1134