View Code of Problem 80

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

Double click to view unformatted code.


Back to problem 80