R
R
Rishat Sultanov2016-05-28 11:02:35
Java
Rishat Sultanov, 2016-05-28 11:02:35

Convert degrees Celsius to Fahrenheit. Can't declare a variable?

import java.util.Scanner;
/*
 * By Rishat Sultanov
 Градусы по Фаренгейту = (градусы по Цельсию x 1.8) + 32
Соответственно, из 'F в 'C можно перевести по следующей формуле:
Градусы по Цельсию = (градусы по Фаренгейту - 32) / 1.8 
 */
public class Trans {
    public static void main(String[] args) {
        int a;
        int d = 32;
        double c;
        double b = 1.8;
        String s1, s2;
        System.out.println("Введите градусы по цельсии:");
        a = new Scanner(System.in).nextInt();
        System.out.println("Ваши градусы в Фаренгейтах:" + c);
        c = a * b + d;
    }
}

The compiler wants to assign a value to c. But she has to be removed from me. Where is the mistake?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question