void main()
{
int a = 5;
int b = 7;
int c = 2;
int res;
res = (int)(a/b)?a:b;
res = (int)(res/c)?res:c;
printf("big num = %d",res);
}
Chat with our AI personalities
You cannot compare 2 numbers without using relational operators. Certainly, you could subtract them, but you still need to test the result, and that is a relational operator in itself.
There are 5 operators which cannot be overloaded. They are: * .* - class member access operator * :: - scope resolution operator * . - dot operator * ?:: - conditional operator * Sizeof() - operator Note:- This is possible only in C++.
int a, b, c, d, max, min; scanf("%d%d%d%d",&a, &b, &c, &d); (a>b)?(max=a,min=b):(max=b,min=a); (c>d)?(a=c,b=d):(a=d,b=c); max=(a>max)?a:max; min=(b<min)?b:min; printf("%d %d\n", max, min);
By subtracting any two of the numbers A-B , if the output number is negative , B IS GREAT and if its positive A is great
int i, largest=0;do { scanf ("Enter a number (0 to exit): %d", i); if (i>largest) largest=i; } while (i!=0); printf ("Largest number is: %d\n", largest);