LHS and RHS

Oct 20, 2019 at 8:47am
Jojo is learning new subject, Calculus I, and recently he found some difficulties. The Lecturer assign some exercises about inequalities and apparently, Jojo quite interest with those problems and he is trying to solve it.
From those inequalities problems, Jojo should determine whether the left-hand side (LHS) of the operation produce greater result than the right-hand side (RHS) operation. Every problems always in a×b...c+d model. As a friend, Jojo ask you to help him make sure that the result is True or False.
Format Input
The input file consists of 4 integers a,b,c,d as described above. It is guaranteed that input file not greater than 1,000,000.
Format Output
Output a line containing the result of the problem given on input file. Print ”True” if LHS is greater than RHS, or print ”False” otherwise.
Oct 20, 2019 at 9:11am
is it use if else statement?
Oct 20, 2019 at 10:12am
No. It's read in the four integers.
Oct 20, 2019 at 10:43am
#include<stdio.h>

int main()
{
long long int a, b, c, d, x, y;

scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

x=a*b, y=c+d;
if(x>y){
printf("True\n");
}else
printf("False\n");

return 0;
}

correct?
Oct 20, 2019 at 12:43pm
Depends on the input format. What's the input format? Is it

1 2 3 4

or 1, 2, 3, 4

or 1 - 2 - 3 - 4

or 1*2...3+4

or what?

Also, you appear to be writing C code. Why not write C++ instead?

Why x=a*b, y=c+d;?
Why not
1
2
x=a*b;
 y=c+d;
?
Last edited on Oct 20, 2019 at 12:44pm
Topic archived. No new replies allowed.