View Code of Problem 31

#include <stdio.h>

int main()
{
	int i, j, k, p;
	while(scanf("%d", &k) != EOF){
		p = 0;
		for(j = 1; ; j++){
			if(j % 3 == 2 && j % 5 == 3 && j % 7 == 2){
				p++;
			}
			if(p == k){
				break;
			}
		}
		printf("%d\n", j);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 31