View Code of Problem 80

#include<iostream>
#include<algorithm>
using namespace std;

int main(){
	int n;
	while(cin>>n,n!=0){
		int temp=0;
		for(int i=2;i<=n;++i){
			temp = (temp+3)%i;
		}
		cout<<temp+1<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 80