Kindly help me here | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Kindly help me here

Kindly help me complete this project please..... I was done with the lessons in 4 days and am unable to get my certificate since have not been able to complete the projects😭 You need to create a function that takes two parameters and returns the sum of all numbers between the two parameters inclusive. The given code takes two numbers from input and passes them to a function called rangeSum(). Task Define the rangeSum() function, so that the code works as expected. Sample Input 4 9 Sample Output [1] 39 Explanation For the inputs 4 and 9, the returned value should be 39.

14th Mar 2023, 11:28 AM
PHILEMON MAKUBO NYAMAGAINI
PHILEMON MAKUBO NYAMAGAINI - avatar
4 Answers
+ 2
What is your attempt?
14th Mar 2023, 11:39 AM
Justice
Justice - avatar
+ 2
PHILEMON MAKUBO NYAMAGAINI Please do yourself firstly and if you have doubt or error in code then share to us, we try to solve your doubt/error on your code.
14th Mar 2023, 12:25 PM
Sakshi
Sakshi - avatar
0
Justice here is what I tried... rangeSum<-function(a,b){ rangeSum<-0 for(i in a:b){ rangeSum<-rangeSum+i } return(rangeSum) } rangeSum(42,64) but I got only test case 1 correct. the rest are marked wrong I don't know why
15th Mar 2023, 12:42 PM
PHILEMON MAKUBO NYAMAGAINI
PHILEMON MAKUBO NYAMAGAINI - avatar
0
Sakshi , SYED ARHAM HASAN Justice here is what I tried... rangeSum<-function(a,b){ rangeSum<-0 for(i in a:b){ rangeSum<-rangeSum+i } return(rangeSum) } rangeSum(42,64) but I got only test case 1 correct. the rest are marked wrong I don't know why
15th Mar 2023, 12:45 PM
PHILEMON MAKUBO NYAMAGAINI
PHILEMON MAKUBO NYAMAGAINI - avatar