View Code of Problem 80

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = 0, x = 0;

        while((n = sc.nextInt()) != 0) {
            for(int i = 1; i <= n; i++) {
                x = (x + 3) % i;
            }
            System.out.println(x + 1);
        }
    }
}

Double click to view unformatted code.


Back to problem 80