Ask a New Question

Question

Sarah and Jane are running for Student Council President. Write a pseudocode algorithm that will collect ā€˜S’ or ā€˜J’ from a voting pool of 51 students. Tally the votes for each candidate and print the winners Name along with the total number of votes received.
3 years ago

Answers

oobleck
s=0
j=0
for i=1..51
read vote
s++ if vote == "S"
j++ if vote == "J"
next i
print (s>j) ? "Sarah "+s : "Jane "+j
3 years ago

Related Questions

Sarah Jane has a set of photographs (fewer than a thousand) which she's going to put in a photograph... Sarah has been running a dog-walking business since 2010. She walks dogs twice a day, takes them to... Jane has A'x apples, Jane removes pi apples, how many apples does Jane have left? Jane lives in Spain. Jane is a farmer. Jane wants to leave Spain. She decided France is the best pla... Jane lives in Spain. Jane is a farmer. Jane wants to leave Spain. She decided France is the best pla... Ned and Sarah were running a relay race. The race was 22.01 kilometers total. If Ned ran 9.41 kilome... Jane lives in Spain. Jane is a farmer. Jane wants to leave Spain. She decided France is the best pla...
Ask a New Question
Archives Contact Us Privacy Policy Terms of Use