View Code of Problem 80

#include <iostream>
using namespace std;

int main(){
  int n,s,m=3;
  while(scanf("%d",&n)!=EOF&&n){
    s = 0;
    for(int j=2;j<=n;j++){
      s = (s+m)%j;
    }
    printf("%d\n",s);
  }
  return 0;
}

Double click to view unformatted code.


Back to problem 80