Variables, Data Types, Constants and Operators

Additional Exercises


  1. Write a program which prompts the user to enter 2 integer values. The program will then print their sum, difference, product, quotient and remainder.

  2. Write a program which will prompt the user to enter a positive floating point number. The program will then display the integral part and the fractional part of the number.

    For example:-
    number = 2.33
    integral = 2
    fractional = 0.33

  3. Write a program which prompts the user to enter a number of days, hours and minutes. The program will then calculate and display this as a total number of minutes.

    For example
    days = 1
    hours = 12
    minutes = 15
    Total number of minutes = 2175


Back to Main Page for Lecture 2