View Code of Problem 80

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

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

Double click to view unformatted code.


Back to problem 80