View Code of Problem 80

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;


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

Double click to view unformatted code.


Back to problem 80