View Code of Problem 80

import java.util.Scanner;
 
public class Main
{
  public static void main(String[] args)
  {
    Scanner scan=new Scanner(System.in);
    int n,x=0;
    while((n=scan.nextInt())!=0)
    {
      for(int i=1;i<=n;i++)
      {
        x=(x+3)%i;
      }
      System.out.println(x+1);
    }
    scan.close();
  }
}

Double click to view unformatted code.


Back to problem 80