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
Write a program to print "hello world" without using a semicolon?
Which control loop is recommended if you have to execute set of statements for fixed number of times?
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 ].
How can I list all of the predefined identifiers?
What is signed and unsigned?
How many types of operators are there in c?
Differentiate call by value and call by reference?
Explain how can I read and write comma-delimited text?
Difference between Shallow copy and Deep copy?
What is a const pointer?
writ a program to compare using strcmp VIVA and viva with its output.
How can you allocate arrays or structures bigger than 64K?
What functions are used in dynamic memory allocation in c?
#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); }
How is a macro different from a function?