View Code of Problem 31

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

Double click to view unformatted code.


Back to problem 31