From 18a0cc30c10c0998fd56e7f82dd5a23e604979f1 Mon Sep 17 00:00:00 2001 From: csoapyhands-gif Date: Mon, 23 Mar 2026 22:42:32 +0400 Subject: [PATCH] Create R_1_8.cpp Solution to R_1_8, as in the textbook. --- chapter_1/exercise/R_1_8.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 chapter_1/exercise/R_1_8.cpp diff --git a/chapter_1/exercise/R_1_8.cpp b/chapter_1/exercise/R_1_8.cpp new file mode 100644 index 0000000..87ad340 --- /dev/null +++ b/chapter_1/exercise/R_1_8.cpp @@ -0,0 +1,27 @@ +#include +using namespace std; + +bool isMultiple(int num1, int num2) { + if (num1 % num2 == 0) { + return true; + } + return false; + +} + +//Program to test the function. +int main() { + int num1; + int num2; + + cout << "Enter a whole number: "; + cin >> num1; + + cout << "Enter another whole number: "; + cin >> num2; + + bool value = isMultiple(num1, num2); + cout << value; + + return 0; +}