Write a Java program to calculate the modules of two numbers without using any inbuilt modulus operator
- برمجة جافا
- برمجة
- 2021-05-01
- razanmazen8711884270
الأجوبة
import java.util.*;
public class Exercise65 {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Input the first number : ");
int a = in.nextInt();
System.out.print("Input the second number: ");
int b = in.nextInt();
int divided = a / b;
int result = a - (divided * b);
System.out.println(result);
}
}
Sample Output:
Input the first number : 19 Input the second number: 7 5
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال