This is what i have so far, but i am not too sure how to input the percentage of the total votes received by the candidate. Here is the assignment Write a program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate's name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. I really would appreciate the help. Thanks
percentage like 5% for first candidate and stuff ?
correct me if i'm wrong sum up all of numvote from every candidate lets say we put it to sum, then for each candidate divide their numvotes with sum and multiply with 100
yes that is correct i just don't know how to add that to the code. So basically say the first candidate had 10 votes and the 2nd had 20 and the third had 5 and the 4th had 15 and the fifth had 25 add the votes up than display what each percentage of votes the candidate had compared to the other candidates.
Well you know how to itterate through the array, its pretty much the same to sum. You can count sum and find percentage in seperate for statement after input, or find sum along with the input