Program to find larger of the two numbers without using if-else,while,for,switch
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / nidhish mathew
#include<stdio.h>
#include<math.h>
int main()
{
int i,j;
scanf("%d%d",&a,&b);
printf("Greater Number is %d",(a+b+abs(a-b))/2);
printf("Smallest Number is %d",(a+b-abs(a-b))/2);
}
Is This Answer Correct ? | 16 Yes | 8 No |
Answer / kristian vitozev
#include <stdio.h>
int main(void)
{
int a = 7, b = 25;
a>b ? printf("%d [a]",a) : printf("%d [b]", b);
return 0;
}
Is This Answer Correct ? | 9 Yes | 8 No |
#include<stdio.h>
#include<conio.h>
void main()
{
int a=90 , b=-89;
(a>b)?printf("a is larger") : printf(" b is larger ");
getch();
}
thank u
Is This Answer Correct ? | 7 Yes | 7 No |
Answer / amit
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
(a>b)?printf("a is larger") : printf(" b is larger ");
getch();
}
Is This Answer Correct ? | 7 Yes | 7 No |
Answer / 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 |
Answer / raj sarswat
void main()
{
int a,b;
printf("enter the value of a and b");
scanf("%d,%d",&a,&b);
a>b?printf("%d",&a):printf("%d",&b);
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ankit chhajed
Take 3 and 150 and use code given in answer 6. We will not get the correct answer..!!!
Please give the changed code!!
Is This Answer Correct ? | 0 Yes | 1 No |
What is the difference between ++a and a++?
Can a function argument have default value?
FILE PROGRAMMING
how many header file is in C language ?
44 Answers College School Exams Tests, CTS, IBM, IMS, Infosys, ME, Sign Solutions, Wipro, XVT,
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
give one ip, find out which contry
What is the auto keyword good for?
Give me basis knowledge of c , c++...
Is c is a procedural language?
Is a pointer a kind of array?
Write a progarm to find the length of string using switch case?
Stimulate calculators to perform addition,subtraction,multiplication and division on two numbers using if/else statement?