View Code of Problem 80


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            if (n == 0)
                break;
            int s = 0;
            for (int i = 1; i <= n; i++) {
                s = (s + 3) % i;
            }
            System.out.println(s + 1);
        }
    }
}

Double click to view unformatted code.


Back to problem 80