2025-11-30 13:42:16 +01:00
|
|
|
#include <iostream>
|
|
|
|
|
|
2026-02-20 00:37:32 +01:00
|
|
|
int multiplication(int a, int b) {
|
|
|
|
|
int answer = 0;
|
|
|
|
|
for (int i = 0; i < a; i++) {
|
|
|
|
|
answer += b;
|
|
|
|
|
}
|
|
|
|
|
if (answer != a * b) {
|
|
|
|
|
std::cout << "There is a mistake in your code!" << std::endl;
|
|
|
|
|
return -1;
|
|
|
|
|
} else
|
|
|
|
|
return answer;
|
2025-11-30 13:42:16 +01:00
|
|
|
}
|
|
|
|
|
|
2026-02-20 00:37:32 +01:00
|
|
|
int main() {
|
|
|
|
|
int a, b;
|
|
|
|
|
std::cout << "Enter number a" << std::endl;
|
|
|
|
|
std::cin >> a;
|
|
|
|
|
std::cout << "Enter number b" << std::endl;
|
|
|
|
|
std::cin >> b;
|
|
|
|
|
std::cout << multiplication(a, b) << std::endl;
|
|
|
|
|
return 0;
|
2025-11-30 13:42:16 +01:00
|
|
|
}
|