Machine Problem No. 1 The results from the mayor's race have been reported by each precinct as follows: Candidate Candidate Candidate Candidate Precincts A B D 1 192 48 206 37 2 147 90 312 21 3 186 12 121 38 4 114 21 408 39 5 267 13 382 29 Write a program to do the following: a. Print out the table with the appropriate headings for the rows and columns. b. Compute and print the total number of votes received by each candidate and the percent of the total votes cast. c. If any one candidate received over 50 percent of the total votes, the program should print a message declaring that candidate the winner. d. If no candidate received 50 percent of the votes, the program should print a message declaring a run-off between the two candidates who received the highest number of votes; two candidates should be identified by their letter names. e. Run the program once with the preceding data and once with candidate C receiving only 108 votes in precinct 4. (note: test values are not limited to the preceding data) Note: Use Array for this machine problem
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
please help me code this in C
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images