1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Leno4ka [110]
3 years ago
5

Write a program that will ask the user to input 5 test grades. Store the test grades in an array. Last output the tests from the

array onto the display screen.
Sample Run: Your program must run exactly like the example below.

Enter grade 1: 100

Enter grade 2: 90

Enter grade 3: 89

Enter grade 4: 77

Enter grade 5: 100

Grade #1: 100

Grade #2: 90

Grade #3: 89

Grade #4: 77

Grade #5: 100

Press any key to continue
Computers and Technology
1 answer:
uranmaximum [27]3 years ago
5 0

Answer:

Following are the program of C++

#include <iostream> // header file

#include <iomanip> // header file  

using namespace std; // namespace

int main() // main function

{

int grade[5],k; // declaration of array  and variable

for (int i = 0;  i< 5; i++) // iterating over the loop

{

cout << "Enter grade ";

cin >> grade[i]; // read the grade by the user

}

k=0;

while(k<5) // iterating over the loop

{

cout << "Grade #" << k + 1 << ": ";

cout << grade[k] << endl; // display the grade  

k++; // increment of i

}

}

Output:

Enter grade 45

Enter grade 5

Enter grade 8

Enter grade 6

Enter grade 7

Grade #1: 45

Grade #2: 5

Grade #3: 8

Grade #4: 6

Grade #5: 7

Explanation:

The description of the program is given below.

  • Declared an array "grade" of int type  
  • Read the grade elements by the user using the for loop
  • finally, display the grade in the given format which is mention in the question.
You might be interested in
Which element is located on the top left of the Word screen?
victus00 [196]
The <span>element located on the top left of the Word screen is the Quick Access Toolbar.  </span>On the quick access toolbar, you can find some of the common functions that you will need to use on a regular basis, it contains commands that are used most often, for example Redo, Undo and Save etc.
7 0
2 years ago
Suzanne is following a fad diet. She has started to experience low energy during her workouts, and on a recent trip to the docto
Nastasia [14]

Answer:

Hi mate....

Explanation:

This is ur answer....

<em>-</em><em>-</em><em>></em><em> </em><em>Suzanne just facing low carbohydrates</em>....

hope it helps you,

mark me as the brainliest pls....

Follow me!

5 0
2 years ago
Read 2 more answers
What is the preferences of occupation in ones life?
umka21 [38]

Answer:

mark me brai list i request u

6 0
2 years ago
A personal identification number (PIN) that opens a certain lock consists of a sequence of 3 different digits from 0 through 9,
Elan Coil [88]

Answer:

<u>720</u> possible PIN can be generated.

Explanation:

To calculate different number of orders of digits to create password and PIN, we calculate permutation.

Permutation is a term that means the number of methods or ways in which different numbers, alphabets, characters and objects can arranged or organized. To calculate the permutation following formula will be used:

nPr = n!/(n-r)!

there P is permutation, n is number of digits that need to be organize, r is the size of subset (Number of digits a password contains)

So in question we need to calculate

P=?

where

n= 10   (0-9 means total 10 digits)

r= 3     (PIN Consist of three digits)

So by using formula

10P3 = 10!/(10-3)!

        =10!/7!

        = 10x9x8x7!/7!

        = 10x9x8

        = 720

7 0
3 years ago
- Create a Java program in both Windows and Ubuntu using any of their Editors *** DO NOT USE IDE'S SUCH AS ECLIPSE, NETBEANS, ET
Marat540 [252]

Answer:

Following are the code to this question:

public class ArrayMath//defining a class ArrayMath

{

public static void main(String[] args) //defining main method

{

int x[][]=new int[10][10]; //defining a 2D array  

arrays(x);//calling a method arrays by passing an array

}

private static void arrays(int[][] x)//defining a method arrays

{

int odd_column_sum=0,sum_of_Elements=0,i,j,even=1;//defining integer variable  

for(i=0;i<x.length;i++)//defining loop for columns  

{

for(j=0;j<x[0].length;j++)//defining loop for rows

{

x[i][j]=i*j;//multiply the i and j value atore in array

}

}

System.out.println("::The 2D array :: ");//print message

for(i=0;i<x.length;i++)//defining loop for columns

{

System.out.print("\t");//use print method for line space and line break  

for(j=0;j<x[0].length;j++)//defining loop for rows

{

System.out.printf("%d\t",x[i][j]); //print array values

}

System.out.println( );//print for line break

}

for(i=0;i<x.length;i++) //defining loop for Columns

{

for(j=0;j<x[0].length;j++) //defining loop for rows

{

if(even%2!=0)//defining if block for check odd number condition

{

odd_column_sum+=x[j][i];//add odd number of array

}

sum_of_Elements+=x[i][j];//add even number of array

}

even++;//increment even variable value by 1

}

System.out.println("The sum of Odd Columns:"+odd_column_sum);//print odd_column_sum value

System.out.println("The array elements :"+sum_of_Elements);//print sum_of_Elements value

}

}

Output:

please find attached file.

Explanation:

In the above-given code, a class "ArrayMath" is defined, inside the class the main method is declared, which define a 2D array "x", this stores 10 columns and 10 rows and at the last, we call the arrays method by passing an array as a variable.

In the arrays method, integer variable, "odd_column_sum, sum_of_Elements, i, j, and even" is defined, in which variable "i and j" is used in the loop for calculating value, even is used to check odd column and then store its value in the "odd_column_sum" variable, and add whole element value is added into the "sum_of_Elements" variable.

8 0
3 years ago
Other questions:
  • Candace opened an email from a person she didn't know and clicked on a pop-up in the email that installed a virus on her compute
    8·2 answers
  • What are the example of dedicated computers?
    5·1 answer
  • When should you use the Reply All function when replying to an email
    10·2 answers
  • You are sending an email to a coworker requesting that the coworker perform a task. Where should you put your coworker's email a
    8·1 answer
  • Fedora operating system
    9·1 answer
  • Fortnite anyone? i just started tdy so dont be judgiee lol
    6·2 answers
  • Is spin to win paying or is a scam app​
    6·2 answers
  • Design a for loop that gets 6 integer numbers from a user, accumulates the total of them, then displays the accumulated total to
    9·1 answer
  • A trace table is used for
    5·2 answers
  • What are two reasons to tie cables up and out of the way inside a computer case?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!