I'm trying to get a hang of for-loops and set logic but I can't seem to get my test cases correct
//Test case example:
[10 to 20] 11 values eg: 10,11,12,13,14, 15,16,17,18,19, 20
[15 to 20] 6 values eg: 15,16,17,18,19,20
Overlap ie: intersection; values present in A and B would: 6
Union ie: values present in A or B: 11
Percent overlap formula: (Overlap/Union) * 100
Percent overlap eg: (6/11) * 100 = 54.5%
Program would just be 4 inputs and spit out the final value so user input:
10
20
15
20
and the answer is supposed to be 54.5% but I'm getting 100% as an answer...
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.