You are on page 1of 1

Algorithm For Determining Winning Candidate

Start
Declare
Declare
Declare
Declare
Declare

Candidate as String array of size 4


Winvote as integer
i, count as integer
votes as integer array of size 4
constituency, winner as string

Winvote
0
Write ('Good Day user, please enter your constituency')
Read Constituency
For i

1 to 4 Do
Write ('Please enter the name of a candidate')
Read (candidate[i])
Write ('Please enter the number of votes received by the candidate.')
Read Votes[i]

If

Votes[i] > Winvote Then


Winvote

votes[i]

Else
Winvote
If

Votes[i]

Winvote
Winvote Then

Winner

Candidate[i]

Winner

Winner

Else

Endif
Endif
EndFor
Write (' For constituency',' ',constituency,' ','the winner is,',' ',(winner),' ','with','
',winvote,' ','votes.')
STOP

You might also like