-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFahrenheitToCelsius.java
More file actions
56 lines (38 loc) · 1.19 KB
/
FahrenheitToCelsius.java
File metadata and controls
56 lines (38 loc) · 1.19 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import java.util.Scanner;
public class FahrenheitToCelsius {
public static void main(String[] args) {
// TODO Auto-generated method stub
int fahrenheitValue = 0;
// int minFahrenheitValue = 0;
int maxFahrenheitValue = 300;
while( fahrenheitValue <= maxFahrenheitValue ){
int celsiusValue = (int)( (5.0/9)*(fahrenheitValue - 32));
System.out.println(fahrenheitValue + " "+celsiusValue);
// System.out.print(" ");
// System.out.println(celsiusValue);
fahrenheitValue = fahrenheitValue + 20;
}
// String str = "abc";
// System.out.println(str + 13);
// char ch1 = 'a';
// char ch2 = 'b';
//
// System.out.println((char)(ch1 + ch2));
Scanner s = new Scanner(System.in);
System.out.println("Enter first number :");
int first = s.nextInt();
System.out.println("Enter second number :");
int second = s.nextInt();
System.out.println("Enter third number :");
int third = s.nextInt();
if(first >= second && first >= third){
System.out.println(first+ " is greater");
}
else if(second >= first && second >= third){
System.out.println(second + "is greater");
}
else{
System.out.println(third + " is greater");
}
}
}