How to get sum of array elements excluding the numbers between a and b using c language? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to get sum of array elements excluding the numbers between a and b using c language?

where a and b are some elements of array. Have to find sum of array excluding the number between the a and b.

26th Jul 2018, 4:28 PM
Sunil Meena
Sunil Meena - avatar
2 Answers
0
store the two numbers, iterate through the array and add the numbers. then, when you find number a, stop adding the numbers until you reach b, then you can start adding them again
26th Jul 2018, 7:09 PM
hinanawi
hinanawi - avatar
0
what if user inputs b first then a. Then this program won't work.
28th Jul 2018, 8:13 AM
Sunil Meena
Sunil Meena - avatar