0
package com.kevinnielsen.opgaver.betingelser;

import java.util.*;

public class opgave2 {
    public static void main(String[] args) {

        Scanner usdInput = new Scanner(System.in);

        int eur;
        int usd;
        int currency;

        currency = 90;


        System.out.println("Write your amount in usd: ");
        usd = usdInput.nextInt();

        eur = (usd / 90) * 100;

        System.out.println(eur);

    }
}

Let's say I input 100, it should output (100 / 90) * 100 which is 111.11 but instead it outputs 100.

Keveran
  • 29
  • 7
  • Look up "Java int division" since division by ints always returns an int. Here 100/90 returns 1. One way to solve is to do `(100 * usd) / 90` or use doubles and round the result. – Hovercraft Full Of Eels Dec 22 '19 at 17:09

1 Answers1

0

change your data types from int to double

Chris
  • 396
  • 1
  • 6
  • 18