View Code of Problem 80

#include <stdio.h>
#include <string.h>
#include <math.h>
#define N 100

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

Double click to view unformatted code.


Back to problem 80