The results from the mayor's race have been reported by each precinct as follows: P A B C D 1 192 48 206 37 2 147 90 312 21 3 186 12 121 38 Write a program to do the following: i. Display the table with appropriate headings for the rows and columns. ii. Compute and display the total number of votes received by each candidate and the percent of the total votes cast.
1. The results from the mayor's race have been reported by each precinct as follows:
P A B C D
1 192 48 206 37
2 147 90 312 21
3 186 12 121 38
Write a
i. Display the table with appropriate headings for the rows and columns.
ii. Compute and display the total number of votes received by each candidate and
the percent of the total votes cast.
2. Write a program in C++ to display the sum of the series [ 9 + 99 + 999 + 9999 ...].
Test Data :
Input the number or terms:5
Expected Output :
9 99 999 9999 99999
The sum of the series = 111105
3. Write a program in C++ to find the sum of the series 1 +11 + 111 + 1111 + .. n terms.
Test Data :
Input the number of terms : 5
Expected Output :
1 + 11 + 111 + 1111 + 11111
The Sum is : 12345
4. Write a C program to create a new array after replacing all the values 5 with 0 shifting all
zeros to right direction.
Expected Output:
Elements in original array are: 1, 2, 0, 3, 5, 7, 0, 9, 11, 5
Elements in new array are: 1, 2, 0, 3, 7, 0, 9, 11, 0,
Step by step
Solved in 3 steps with 3 images