aboutsummaryrefslogtreecommitdiff
path: root/challenge-142/ulrich-rieke/cpp/ch-1.cpp
diff options
context:
space:
mode:
authorDave Jacoby <jacoby.david@gmail.com>2021-12-07 17:08:53 -0500
committerDave Jacoby <jacoby.david@gmail.com>2021-12-07 17:08:53 -0500
commitf0230b0a58c8d2a63ba172c0c04ac75e5c80e0d4 (patch)
treea7162c0c01b282684f159edc35a2f940a8a77e38 /challenge-142/ulrich-rieke/cpp/ch-1.cpp
parent038f05c9243b83b2b654559b5005506bc6a3fc2b (diff)
parent59dd7ccf422a3b10f31e3ad2cc9a2704ce6b40e0 (diff)
downloadperlweeklychallenge-club-f0230b0a58c8d2a63ba172c0c04ac75e5c80e0d4.tar.gz
perlweeklychallenge-club-f0230b0a58c8d2a63ba172c0c04ac75e5c80e0d4.tar.bz2
perlweeklychallenge-club-f0230b0a58c8d2a63ba172c0c04ac75e5c80e0d4.zip
Merge branch 'master' of https://github.com/manwar/perlweeklychallenge-club
Diffstat (limited to 'challenge-142/ulrich-rieke/cpp/ch-1.cpp')
-rw-r--r--challenge-142/ulrich-rieke/cpp/ch-1.cpp21
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 ;
+}