View Code of Problem 80

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	while(1){
		cin>>n;
		int k = 0;
		if(!n)break;
		for(int i = 2;i<=n;i++){
			k = (k + 3)%i;
		}
		cout<<k+1<<endl;
	}	
	return 0;
}

Double click to view unformatted code.


Back to problem 80