View Code of Problem 31

#include "stdio.h"
#include "string.h"

void main()
{
	long int i;
	int k,count;
	for(;scanf("%d",&k)!=EOF;)
	{
		count=0;
		for(i=0;;i++)
		{
			if(i%3==2&&i%5==3&&i%7==2)
				count++;
			if(count==k)
			{
				printf("%ld\n",i);
				break;
			}
		}

	}
}

Double click to view unformatted code.


Back to problem 31