View Code of Problem 31

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

Double click to view unformatted code.


Back to problem 31