diff options
Diffstat (limited to 'challenge-142/ulrich-rieke/cpp/ch-1.cpp')
| -rw-r--r-- | challenge-142/ulrich-rieke/cpp/ch-1.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/challenge-142/ulrich-rieke/cpp/ch-1.cpp b/challenge-142/ulrich-rieke/cpp/ch-1.cpp new file mode 100644 index 0000000000..59df3c1d2c --- /dev/null +++ b/challenge-142/ulrich-rieke/cpp/ch-1.cpp @@ -0,0 +1,21 @@ +#include <iostream> +#include <vector> +#include <cstdlib> + +int main( int argc, char * argv[ ] ) { + int m = std::atoi( argv[ 1 ] ) ; + int n = std::atoi( argv[ 2 ] ) ; + std::vector<int> divisors ; + for ( int i = 1 ; i < m + 1 ; i++ ) { + if ( m % i == 0 ) { + divisors.push_back( i ) ; + } + } + int output = 0 ; + for ( int num : divisors ) { + if ( num % 10 == n ) + output++ ; + } + std::cout << output << std::endl ; + return 0 ; +} |
