Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Uncomplete function - Simple Mistake

$
0
0
Hello everyone,
How can I solve this problem "not all code paths return a value"

        static int Multiplication(int a, int B)/>
        {
        int res = 0;
        while (b > 0)
    {
        res += a;
        b = b - 1;
    }
        Console.WriteLine(res);
        }


For me all code paths return a value...
If b =< 0 then return res
else if b > 0 do the loop then return res

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>