Sunday, 5 November 2017

javaprogram that check first number is multiple of second number.



Problem 11:
Write a program that check first number is multiple of second number.
Discripition:
Using remainder operator
Solution:

import java.util.*;
public class Message {
 public static void main(String[] args) {
  Scanner input= new Scanner(System.in);
   System.out.println("Enter the frist number");
    int num=input.nextInt();
   System.out.println("Enter the second number");
    int num1=input.nextInt();
    if(num%num1==0)
    System.out.println("This is multiple");
    else
        System.out.println("This is not multiple ");
 }}
Output:



No comments:

Post a Comment