View Code of Problem 31

#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	long int k;
	while(scanf("%ld",&k)!=EOF)
	{
		int count=0,i;
		for(i=23;i!=0;i++)
		{
			if(i%3==2&&i%5==3&&i%7==2)
			{
				count++;
			}
			if(count==k)
			{
				break;
			}
		}
		printf("%ld\n",i);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 31