It works if I enter 10 and then 2, it gives me 5.
But I am applying it in another program and now I release to try and it does not give me the results that it has decimals that is to say the division of 2/10
that would be 0.2
does not show it to me.
Why? what am I doing wrong?
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Introduce dos numeros para dividir\nNumero: ");
int num1 = sc.nextInt();
System.out.print("Numero: ");
int num2 = sc.nextInt();
float div = num1/num2;
System.out.println("La division de "+num1+"/"+num2+" = " +div);
}