Home / python to pseudocode converter online / Example algorithm (pseudocode) for the following …
Example algorithm (pseudocode) for the following problem:
Every day, a weather station receives 15 temperatures expressed in degrees Fahrenheit. A program is to be written which will accept each Fahrenheit temperature, convert it to Celsius and display the converted temperature to the screen. After 15 temperatures have been processed, the words "All temperatures processed" are to be displayed on the screen.
Pseudocode (remember this is not the only solution)
Fahrenheit_Celsius_conversion
Set temperature_count to zero
WHILE temperature_count < 15
prompt operator for f_temp
get f_temp
compute c_temp = (f_temp - 32) * 5/9
display c_temp
add 1 to temperature_count
END WHILE
Display "All temperatures processed" to the screen
END
[pic]
Example trace of following program
Using the input stream of 5 3 2 5 4 1 7 8 trace the following program. i.e. track each variable through the entire program showing the values of the variables at the end of each iteration , also show all output . Write a statement explaining what the program does.
#include
using namespace std;
int main ()
{
int count, sum, number;
bool lessThanFive ;
count = 0;
sum = 0;
number = 0;
lessThanFive = true;
while (lessThanFive)
{
cin >> number;
if (number % 2 = = 1)
{
count++;
sum = sum + number;
lessThanFive = (count < 5);
}
}
cout
How to write a pseudo code? Part 3 Part 3 of 3: Creating an Example Pseudocode Document Open a plain-text editor. You can use Notepad (Windows) or TextEdit (Mac) by default if you don't want to install a new program. Define your program. This program will request a greeting from the user. ... Write the opening sequence. Add the next line. ... Add the call to action. Show the user a list of responses. Request input from the user. More items...