how to calculate the sum of numbers using the rec procedure
I created a program using the Recursive procedure to calculate the sum of two numbers, but when I use variables a and b when a = 2 and b = 3 then the result is not 6.
I don't understand ... You said the code was supposed to "sum two numbers". So let <a> be 2, and <b> be 3, Now you add the two, obviously you should get 5 rather than 6. Except if you meant to multiply ...
Ipang well. he said to use recursive procedure. i tried doing what he had given aand it gave an segmentation error
Coding Kitty You probably didn't have a base case in whatever you were doing (I don't how you can add 2 numbers using recursion, 3 or more I can understand). No base case means infinite recursion, means stack overflow, means segmentation fault.
your question is now my property
Coding Kitty, Let's wait for OP's confirmation, and hopefully a tryout code.
Ipang sorry, I was wrong. multiply two numbers with the addition concept that I entered.
Ipang I haven't used that yet, I'm still using for: '(
Hi Puspa, Are you using array to do this? cause my idea is only based on the use of an array for this.
Puspa Sari, In case you haven't gotten it figured out, this one gives an example without use of array. https://www.studytonight.com/c/programs/recursion/adding-two-numbers-using-recursion
I have tried every way I could find but still I can't display my local images ..what am I doing wrong?
Pls rectify the errors.
I cant understand what the problem here is. Can anyone help me out? the system in sololearn called it an error in test case 1
Izzy the iguana code coach