Skip to content

Instantly share code, notes, and snippets.

@ProZhar
Created December 6, 2015 18:10
Show Gist options
  • Select an option

  • Save ProZhar/0382b9d0e065dbe952a1 to your computer and use it in GitHub Desktop.

Select an option

Save ProZhar/0382b9d0e065dbe952a1 to your computer and use it in GitHub Desktop.
com.javarush.test.level10.lesson04.task02
package com.javarush.test.level10.lesson04.task02;
/* Задача №2 на преобразование целых типов
Расставьте правильно операторы приведения типа, чтобы получился ответ: d=3.765
int a = 15;
int b = 4;
float c = a / b;
double d = a * 1e-3 + c;
*/
public class Solution
{
public static void main(String[] args)
{
int a = 15;
int b = 4;
float c = (float) a / b;
double d = a * 1e-3 + c;
System.out.println(d);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment