View Code of Problem 80

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

Double click to view unformatted code.


Back to problem 80