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

Answer Posted / vara

#include<stdio.h>
void main()
{
int a,b;
printf("enter a and b values");
scanf("%d%d",&a,&b);
a>b?printf("%d",a):printf("%d",b);
}

Is This Answer Correct ?    89 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When should you use a type cast?

798


What is pass by value in c?

767


what is stack , heap ,code segment,and data segment

2424


What is meant by 'bit masking'?

1095


write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);

2086


What is the use of linkage in c language?

814


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

1144


I have seen function declarations that look like this

781


With the help of using classes, write a program to add two numbers.

827


Is main an identifier in c?

830


using only #include and #include Write a program in C that will read an input from the user and print it back to the user if it is a palindrome. The string ends when it encounters a whitespace. The input string is at most 30 characters. Assume the string has no spaces and distinguish between and lowercase. So madam is a palindrome, but MadAm is not a palindrome. Use scanf and %s to read the string. Sample Test: Enter a string: madam madam is a palindrome. Enter a string: 09023 09023 is not a palindrome.

1567


Explain pointers in c programming?

845


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

1678


How to set file pointer to beginning c?

894


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.

1256