Julio Cesar Chavez Mark VII is an interplanetary space boxer, who currently holds the championship belts for various weight categories on many different planets within our solar system. However, it is often difficult for him to recall what his "target weight" needs to be on earth in order to make the weight class on other planets. Write a program to help him keep track of this
Examine the incomplete program below. Write code that can be placed below the comment (// Write your code here) to complete the program. Use nested loops to calculate the sums and averages of each row of scores stored in the 2-dimensional array: students so that when the program executes, the following output is displayed.
Average scores for students:
Student # 1: 12
Student # 2: 22
CODE:
#include <iostream>
using namespace std;
int main()
{
const int NUM_OF_STUDENTS = 2;
const int NUM_OF_TESTS = 3;
int sum = 0, average = 0;
double students[NUM_OF_STUDENTS][NUM_OF_TESTS] =
{
{11, 12, 13},
{21, 22, 23}
};
double averages[NUM_OF_STUDENTS] = {0, 0};
// Write your code here:
cout << "Average scores for students: " << endl;
for (int i = 0; i < NUM_OF_STUDENTS; i++)
cout << "Student # " << i + 1 << ": " << averages[i] << endl;
return 0;
}
Examine the incomplete program below. Write code that can be placed below the comment (// Write your code here) to complete the program. Use nested loops to calculate the sums and averages of each row of scores stored in the 2-dimensional array: students so that when the program executes, the following output is displayed.
OUTPUT:
Average scores for students:
Student # 1: 12
Student # 2: 22
CODE:
#include <iostream>
using namespace std;
int main()
{
const int NUM_OF_STUDENTS = 2;
const int NUM_OF_TESTS = 3;
int sum = 0, average = 0;
double students[NUM_OF_STUDENTS][NUM_OF_TESTS] =
{
{11, 12, 13},
{21, 22, 23}
};
double averages[NUM_OF_STUDENTS] = {0, 0};
// Write your code here:
cout << "Average scores for students: " << endl;
for (int i = 0; i < NUM_OF_STUDENTS; i++)
cout << "Student # " << i + 1 << ": " << averages[i] << endl;
return 0;
}
input:
4
after
a b c d
f e f g
t e r r
a b i j
output wants to come : [(0, 0),(1, 0),(2, 0),(2, 1),(2, 2)]
4
search
s e a c
r c c c
h e e e
h e e e
output wants to come: "Not Present"
Ravans dream in to win the Tic Tac Toe campionship to accomplish this he practices alone at home to learn the strategies the game .your tast is to identify the cell where Ravan should place the third piece so that the wins the game Assume the each cell in the tic tac toe board in marked a number as shown in the table below
0 1 2
3 4 5
6 7 8
the first line of input contains space-seperated integers representing the cells where Ravan his first two pieces
the output should be single integers representing cell where Ravanshould places his final place
sample input 1
0 1
sample output 1
2
sample output 2
0 3
sample output 2
6
4. Create a program that will plot the equation of the line y=mx+b using an array.
array1 ==> x - input by user
m = constant - input by user
b = constant - input by user
array2 ==> y - computed
Create a program with a one-dimensional array that searches for a number within the array, and how many times the number appears on the array.
by CodeChum Admin
I’ve been too positive in life, but I figured that it really isn’t good to always be positive since life has to be balanced, don’t you think so?
That aside, let’s make a program that asks for random integers, positive or negative, and sums up all the negative integers only! Well, the loop stops when the inputted value is 0, though.
And don’t forget to print the sum of negative integers afterwards! Thanks!
Input
1. A series of integers
Output
Multiple lines containing message prompts to input integers.
The last line contain the sum of the negative integers.
Enter·n:·1
Enter·n:·3
Enter·n:·-1
Enter·n:·-2
Enter·n:·-4
Enter·n:·5
Enter·n:·-1
Enter·n:·-2
Enter·n:·0
Sum·of·negatives·=·-10
by CodeChum Admin
The greatest common divisor, also known as GCD, is the greatest number that will, without a remainder, fully divide a pair of integers.
Now, I want you to make a program that will accept two integers and with the use of loops, print out their GCD. Make good use of conditional statements as well.
Off you go!
Input
1. First integer
2. Second integer
Output
The first line will contain a message prompt to input the first integer.
The second line will contain a message prompt to input the second integer.
The last line contains the GCD of the two integers.
Enter·the·first·integer:·6
Enter·the·second·integer:·9
GCD·of·6·and·9·is·3
by CodeChum Admin
I'm really fond of even numbers, you know? That's why I'll be letting you make another even number problem yet again. This time, you need to print from a range of two inputted numbers, n1 and n2 (inclusive), all the even numbers from n2 down to n1, in descending order.
How about that?
Input
1. Value of n1
2. Value of n2
Output
The first line will contain a message prompt to input the value of n1.
The second line will contain a message prompt to input the value of n2.
The succeeding lines contain an integer.
Enter·n1:·3
Enter·n2:·10
10
8
6
4