Menu Close

Find the greatest number with a numerator and denominator…[Cprogm]FTC 

Darsh, Ratik, Swathy are good friends. They are studying Pre-final year B.E. Electronics and Communication Engineering. 

Swathy’s uncle was a maths teacher in a high school. 

He requested Swathy to make an application for identifying the greatest number with a numerator and denominator. 

You have to contribute for the development of the application. Can you do it?

Input:
The First line of input has two values of type integer representing the the numerator, denominator value of first input

The Second line of input has two values of type integer representing the the numerator, denominator value of second input


Output:
Print the greatest value.

#include <stdio.h>
struct fraction
{
  int numerator,denominator;  
};
int main(){

struct fraction v1;
struct fraction v2;

scanf("%d%d",&v1.numerator,&v1.denominator);
scanf("%d%d",&v2.numerator,&v2.denominator);

if(v1.numerator/v1.denominator > v2.numerator/v2.denominator)
{printf("%d/%d is greater than %d/%d",v1.numerator,v1.denominator,v2.numerator,v2.denominator);}

else{printf("%d/%d is smaller than %d/%d",v1.numerator,v1.denominator,v2.numerator,v2.denominator);}

return 0;
}


INPUT_1:
12  12
12  22

OUTPUT:
12/12  is greater than  12/22


INPUT_2:
113  131
111  121

OUTPUT:
113/131  is smaller than  111/121


INPUT_3:
24  42
32  53

OUTPUT:
24/42  is smaller than  32/53


INPUT_4:
1  1
2  2

OUTPUT:
1/1  is smaller than  2/2


INPUT_5:
3  4
4  4

OUTPUT:
3/4  is smaller than  4/4


ILLUSTRATION:

EXECUTED USING GCC LINUX