View Code of Problem 80

#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	int n,j=0;
	while(scanf("%d",&n)!=EOF)
	{
		if(n==0)
			break;
		for(int i=1;i<=n;i++)
		{
			j=(j+3)%i;
		}
		printf("%d\n",j+1);
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 80