Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Main {
- public static int modulusRec(int x, int y) {
- if (x == 0) return 0;
- if (x < y) return x;
- return modulusRec(x - y, y);
- }
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int x = sc.nextInt();
- int y = sc.nextInt();
- if (y < 0) {
- System.out.println("Errrrrrror!!!!!!");
- return;
- }
- System.out.println(modulusRec(5, 3));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment