View Code of Problem 31

#include <iostream>
using namespace std;

int main(){
    int j,k,count;
    while(scanf("%d",&k)!=EOF){
        count = 0;
        for(j = 1;count!=k;j++){
            if(j%3==2 && j%5==3 && j%7==2)
                count ++;
        }
        printf("%d\n",j-1);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 31