8.2k views
0 votes
!! PSEUDOCODE ONLY !!

A "jiffy" is the scientific name for 1/100th of a second. Define a function named SecondsToJiffies that takes a float as a parameter, representing the number of seconds, and returns a float that represents the number of "jiffies". Then, write a main program that reads the number of seconds as an input, calls function SecondsToJiffies() with the input as argument, and outputs the number of "jiffies".

Ex: If the input of the program is:

15
the function returns and the program outputs:

1500.0

1 Answer

4 votes

Function: SecondsToJiffies(seconds)

Input:

seconds: float - number of seconds to convert to jiffies

Output:

jiffies: float - number of jiffies equivalent to the input seconds

Steps:

Multiply the input seconds by 100 to convert to jiffies.

Return the result.

Pseudocode:

Function SecondsToJiffies(seconds)

jiffies = seconds * 100

return jiffies

Main program:

Read input_seconds as float from user

jiffies = SecondsToJiffies(input_seconds)

print jiffies

User Llange
by
8.1k points