Given three values - Start Fahrenheit Value (S), End Fahrenheit value (E) and Step Size (W), you need to convert all Fahrenheit values from Start to End at the gap of W, into their corresponding Celsius values and print the table.
Input Format :
3 integers - S, E and W respectively
Output Format :
Fahrenheit to Celsius conversion table. One line for every Fahrenheit and corresponding Celsius value. On Fahrenheit value and its corresponding Celsius value should be separate by tab ("\t")
Answers
[SOLVED] Fahrenheit to Celsius Table in JAVA
Given three values - Start Fahrenheit Value (S), End Fahrenheit value (E) and Step Size (W), you need to convert all Fahrenheit values from Start to End at the gap of W, into their corresponding Celsius values and print the table.
INPUT FORMAT
3 integers - S, E and W respectively separated by space.
OUTPUT FORMAT
Fahrenheit to Celsius conversion table. One line for every Fahrenheit and corresponding Celsius value. On Fahrenheit value and its corresponding Celsius value should be separated by tab ("\t")
Sample
IN====> 0 100 20 //(S E W)
OUT====>
0 -17
20 -6
40 4
60 15
80 26
100 37
Answer:
In Java Program I wrote
import java.util.Scanner;
public class FahrenheitToCelsius(){
public static void main(String args[]){
int S ,E , W, C1 ;
Scanner s=new Scanner(System.in);
S=s.nextInt();
E=s.nextInt();
W=s.nextInt();
while(S<=E) {
C1=((5*(S-32))/9);
System.out.println(S+"\t"+C1);
S=S+W;
}
}
}
Explanation: