View Code of Problem 31

#include<stdio.h>
int main(){
	int k;
	while(~scanf("%d",&k)){
		int arr[k], i;
		int count = 0;
		for(i = 1; ; i ++){
			if(count == k){
				break;
			}
			if(i % 3 == 2 && i % 5 == 3 && i % 7 == 2){
				arr[count ++] = i;
			}
		}
		printf("%d\n",arr[k - 1]);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 31