# Convert Celsius To Fahrenheit

Sun Feb 06 2022 01:30:39 GMT+0000 (UTC)

```// 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
}

}
}```
content_copyCOPY

2. Convert Celsius To Fahrenheit Given a temperature in celsius C. You need to convert the given temperature to Fahrenheit. Example 1: Input: C = 32 Output: 89 Explanation: Using the conversion formula of celsius to farhenheit , it can be calculated that, for 32 degree C, the temperature in Fahrenheit = 89. Example 2: Input: 50 Output: 122 Explanation: Using the conversion formulaof celsius to farhenheit, it can be calculated that, for 50 degree C, the temperature in Fahrenheit = 122. Your Task: You don't need to read input or print anything. Your task is to complete the function CtoF() that takes C as parameter and returns temperature in fahrenheit( in double). The flooring and printing is automatically done by the driver code. Expected Time Complexity: O(1) Expected Auxiliary Space: O(1) Constraints: 1 <= C <= 10^4

https://practice.geeksforgeeks.org/problems/convert-celsius-to-fahrenheit/1/?track=DSASP-Mathematics&batchId=190