Computer Science, asked by anandprakashinjsr, 8 hours ago

Q basic WAP to store time in hour. Now convert and display it into seconds.​

Answers

Answered by anindyaadhikari13
2

\texttt{\textsf{\large{\underline{Solution}:}}}

The given co‎de is written in QBASIC.

CLS

INPUT "Enter time in hour: "; HR

SEC = HR * 3600

PRINT "Time in seconds ="; SEC

END

\texttt{\textsf{\large{\underline{Explanation}:}}}

  • Line 1: Clears the screen.
  • Line 2: Accept time in hours from the user.
  • Line 3: 1 hour is equal to 3600 seconds. So, multiply hour by 3600 to  get time in seconds. Store the result in variable 'SEC'.
  • Line 4: Display the time in seconds.
  • Line 5: End of program.

See the attachment for output.

Attachments:
Similar questions