View Code of Problem 80

#include<iostream>
using namespace std;
int main() {
	int n;
	while (cin >> n && n != 0) {          
                int num = 0, i = 1;
                while (n--)
                {
                    num = (num + 3) % i;
                    i++;
                }
                cout << num + 1 << endl;
            }		
}

Double click to view unformatted code.


Back to problem 80