Type Here to Get Search Results !

Celsius to Fahrenheit using Scanner function in java.

0

 Celsius to Fahrenheit using Scanner function in java.

Convert celsius to fahrenheitGiven a temperature C in Celsius, your task is to convert it into Fahrenheit using the following equation:- F = C × 9/5 + 32

Input :-

An integer, representing the Temperature in Celsuis.

User Task: :-

Convert the given temperature to Fahrenheit and print it.

Note :- 

It is guaranteed that C will be a multiple of 5.

Output :- 

Return a integer containing converted temperature in Fahrenheit.

Illustration:

Program :-

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String args[]) {
     Scanner sc = new Scanner(System.in);
      int c = sc.nextInt();
      int T = 0;
      T = (c * 9)/5 + 32;
      System.out.println(T); 
    }
}

Sample Input :-

25

Sample Output:-
77

Sample Input:-
-40

Sample Output:-
-40


Common Mistakes
Do not print anything extra apart from the temperature in Fahrenheit.

Online Java Compiler -

Post a Comment

0 Comments