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 |
1)what are limitations for recursive function? 2)write a program to read a text file and count the number of characters in the text file
which of the following statements is incorrect a.typedef struct new{ int n1; char n2; } DATA; b.typedef struct { int n3; char *n4; }ICE; c.typedef union { int n5; float n6; } UDT; d.#typedef union { int n7; float n8; } TUDAT;
What is scope rule of function in c?
wat is output of the following int main() { const int j=2; int i; switch(i) { case 1:break; case j:break; default:break; } }
What is the general form of function in c?
Is main() function predfined or userdefined?
wat is the difference between a definition and declaration? float y;---it looks like a declaration..but it s a definition.how?someone explain
A C E G H +B D F A I ------------ E F G H D
write a program without using main function?
What are directives in c?
What are the rules for the identifier?
Explain how are 16- and 32-bit numbers stored?