Codewars C++ registration question | Sololearn: Learn to code for FREE!


Codewars C++ registration question

Signing up for C++ on 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?


5/10/2020 4:34:52 AM

Farhan Ali

5 Answers

New Answer


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; }


Missing return keyword in function declaration return a*b


Oh, alright. Thanks for helping!


Use the return statement bro. Thats missing.


It still isn't working for me, any ideas?