Codewars C++ registration question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Codewars C++ registration question

Signing up for C++ on codewars.com they ask us to fix this code: int multiply(int a, int b) { a * b; } I wrote my own code since they simply want me to multiply a and b: #include <iostream> // for std::cout and std::cin int main() { int a{}; int b{}; std::cout << "Please enter any two numbers between 0 and 10 and click enter.\n"; std::cin >> a; std::cin >> b; std::cout << a * b; return 0; } It gives multiple errors, can someone tell me what the correct code is for the registration and why is my code wrong?

10th May 2020, 4:34 AM
Farhan Ali
Farhan Ali - avatar
6 Answers
+ 3
Farhan Ali I think they just wanted you to put the 'return' keyword in the function. int multiply(int a, int b) { return a * b; }
10th May 2020, 4:42 AM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
+ 3
Missing return keyword in function declaration return a*b
10th May 2020, 5:17 AM
Shahghasi Adil
Shahghasi Adil - avatar
0
Oh, alright. Thanks for helping!
10th May 2020, 5:16 AM
Farhan Ali
Farhan Ali - avatar
0
Use the return statement bro. Thats missing.
10th May 2020, 2:45 PM
Naveed
Naveed - avatar
0
It still isn't working for me, any ideas?
5th Jun 2022, 7:03 AM
weylin p
0
Int add(int a, int b) { return a + b; } Int main() { Int result = add(5, 3) return 0; }
1st Mar 2024, 10:11 AM
Andi Games
Andi Games - avatar