#include<stdio.h> int main() { int t; while(scanf("%d",&t)) { if(t>0) { int i,s=0; for(i=1;i<=t;i++) { s=(s+3)%i; } printf("%d\n",s+1); }else { break; } } return 0; }
Double click to view unformatted code.