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
Why c is faster than c++?
What is the role of this pointer?
What is extern variable in c with example?
In C programming, what command or code can be used to determine if a number of odd or even?
How to write c functions that modify head pointer of a linked list?
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
How can I insert or delete a line (or record) in the middle of a file?
What is the use of the function in c?
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
What is the use of sizeof?
What is the difference between functions abs() and fabs()?
How do c compilers work?
What is keyword in c?
What is the difference between fread and fwrite function?
What is the use of #define preprocessor in c?