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

+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?

c++

5/10/2020 4:34:52 AM

Farhan Ali

4 Answers

New Answer

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

+3

Missing return keyword in function declaration return a*b

0

Oh, alright. Thanks for helping!

0

Use the return statement bro. Thats missing.