Computer Science, asked by jake3055, 17 days ago

Create a program, prompt the user to enter their name. Using their name in the next prompt, ask the user for an integer. Using their name, ask for another integer. Find out if the number that the user entered is divisible by the other. Output the results back to the user.

Answers

Answered by samarthkrv
0

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

 Scanner sc = new Scanner(System.in);

 System.out.println("What is your name?");

 String name = sc.nextLine();

 System.out.print("Enter a number " + name + ":");

 int x = sc.nextInt();

 System.out.print("Enter another number " + name + ":");

 int y = sc.nextInt();

 if(x%y == 0){

     System.out.println(x + " is divisible by " + y);

 }

 else if(y%x == 0){

     System.out.println(y + " is divisible by " + x);

 }

}

}

Explanation:

Similar questions