// Formula : (0°C × 9/5) + 32 = 32°F import java.io.*; import java.util.*; class Solution { public double cToF(int C) { return C*(9.0/5.0)+32.0; } } public class Main { public static void main (String[] args) { Scanner sc=new Scanner(System.in); int T=sc.nextInt();//input number of testcases while(T-->0) { Solution obj=new Solution(); int C; C=sc.nextInt();//input temperature in celscius System.out.println((int)(obj.cToF(C)));//print the output } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter