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;
		int flag=1;
		for(i=2;flag;i=i+7)
{			
			s1=i%3;
			s2=i%5;
			if(s1==2&&s2==3)
				count++;
			if(count==k)
				flag=0;
		}
		i=i-7;
		printf("%d\n",i);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 31