View Code of Problem 80

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

Double click to view unformatted code.


Back to problem 80