This Program Will Find The Largest Among Two Number Without Using If-Else Construct Or Trinary Operator ....
#include<stdio.h>
#include<conio.h>
main()
{
int a,b;
float c;
printf("\n\tEnter 1st Value:==");
scanf("%d",&a);
printf("\n\tEnter 2nd Value:==");
scanf("%d",&b);
c=(float)((a+b)/2)+(float)((a-b)/2);
printf("\n\tThe Largest among %d and %d is %d..",a,b,c);
getch();
}
#include<stdio.h>
#include<conio.h>
main()
{
int a,b;
float c;
printf("\n\tEnter 1st Value:==");
scanf("%d",&a);
printf("\n\tEnter 2nd Value:==");
scanf("%d",&b);
c=(float)((a+b)/2)+(float)((a-b)/2);
printf("\n\tThe Largest among %d and %d is %d..",a,b,c);
getch();
}
No comments:
Post a Comment