View Code of Problem 80

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
//#include<algorithm>
//#include <bits/stdc++.h>

int main() {
	int n;
	while(1) {
		scanf("%d",&n);
		if(n==0) {
			break;
		}
		int m=0;
		for(int i=2; i<=n; i++) {
			m=(m+3)%i;
		}
		printf("%d\n",m+1);
	}
}

Double click to view unformatted code.


Back to problem 80