View Code of Problem 31

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

}

Double click to view unformatted code.


Back to problem 31