24.1k views
4 votes
Convert the following pseudocode to C++ code. Be sure to define the appropriate variables. Store 25 in the speed variable. Store 15 in the time variable. Multiply speed by time and store the result in the distance variable. Display the contents of the distance variable.

User Stathis
by
6.9k points

1 Answer

6 votes

Answer:

int main()

{

int speed = 25, time = 15;

int distance = speed * time;

cout<<"The distance is: " << distance <<endl;

return 0;

}

Step-by-step explanation:

- Initialize the variable speed as 25 and time as 15

- Calculate the distance by multiplying speed and time

- Print the distance

User Manuel Schiller
by
8.8k points