View Code of Problem 31

#include<stdio.h>

int main() {

	long long int temp[102];
	long long int i;
	int count = 0;
	while (count < 101) {
		for (;;i++) {
			if ((i % 3 == 2) || (i % 5 == 3) || (i % 7 == 2)) {
				temp[count++] = i;
			}

		}
	}
	int k;
	while (scanf("%d", &k), k) {
		printf("%lld", temp[k]);
	}
}

Double click to view unformatted code.


Back to problem 31