SUNIL GUTTA

SUNIL GUTTA

  • NA
  • 1k
  • 395.3k

Basic programming help ? logic is enough

Feb 9 2014 1:21 AM
Hi

1) Write a program MathSkills that asks the user to enter 3 numbers. Perform simple computations and output the results as shown below. (Pay attention to spaces, lines, and upper? and lower?case.)


Enter THREE numbers and I will show you my math skills: 5 3 7

Check this out:

5 + 3 - 7 = 1

5 * 3 - 7 = 8

5 * (3 - 7) = -20

5 squared is 25


2) Write a program DayConverter which asks the user to enter a number of days and outputs the equivalent duration in hours, in minutes, and in seconds.

For example:

Enter a number of days:

2

2 days is 48 hours or 2880 minutes or 172800 seconds


3) Write a program HourConverter which asks the user to enter a number of hours and outputs the equivalent duration in weeks+days+hours. (Hint: Use the division and mod operator.)

Here are three examples:


Enter a number of hours:

7

7 hours is 0 weeks, 0 days, and 7 hours


Enter a number of hours:

60

60 hours is 0 weeks, 2 days, and 12 hours


Enter a number of hours:

500

500 hours is 2 weeks, 6 days, and 20 hours


Regards


Answers (1)