View Code of Problem 80

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

Double click to view unformatted code.


Back to problem 80