• Lenguaje

    Java usando Scanner

  • Descripción

    Determinar si un valor N es múltiplo de un valor Z.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import java.util.Scanner;

public class NMultiploDeZ {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N, Z;
        System.out.print("Ingresa el valor de N: ");
        N = in.nextInt();
        in.nextLine();
        System.out.print("Ingresa el valor de Z: ");
        Z = in.nextInt();
        in.nextLine();
        if(Z%N==0)
            System.out.println("N es m\u00FAltiplo de un Z.");
        else
            System.out.println("N no es m\u00FAltiplo de un Z.");
    }

}