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 |
Explain the difference between structs and unions in c?
When should I declare a function?
find the size of structure without using the size of function
Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer
What is the right way to use errno?
Write a program to find the given number is odd or even without using any loops(if,for,do,while)
How can a process change an environment variable in its caller?
Write a simple program to find the size of different basic data types in C.
How can I increase the allowable number of simultaneously open files?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?
void main() { int s[4][2]={ {1234,56},{1212,33},{1434,80},{1312,78} }; int (*p)[2]; int i,j,*pint; for(i=0;i<=3;i++) { p=&s[i]; pint=p; printf("\n"); for(j=0;j<=1;j++) printf("%d",*(pint+j)); } } while running this program it shows a warning-suspicious pointer conversion ie pint=p; my que is why should we assign the value of p to pint again.why cant we use it directly as *(p+j)..but if i use like tat the o/p is garbage value..
What is a sequential access file?