-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyfraction.java
More file actions
34 lines (19 loc) · 820 Bytes
/
myfraction.java
File metadata and controls
34 lines (19 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.util.Scanner;
public class myfraction
{
/* Program that prompts for and reads the numerator and denominator of a fraction as integers then prints the decimal equivalent of the fraction
*/
public static void main(String[] args)
{
int numerator;
int denominator;
double decimalvalue;
Scanner myFraction = new Scanner(System.in);
System.out.println("Enter the numerator");
numerator = myFraction.nextInt();
System.out.println("Enter the denominator");
denominator = myFraction.nextInt();
decimalvalue = numerator/denominator;
System.out.println("numerator/denominator" + " " + decimalvalue );
}
}