PROGRAMMING PRACTICE-PROBLEM QUESTIONS AND
DETAILED SOLUTIONS – VOLUME 3
CONVERSION, MEASUREMENT, AND UNIT EXERCISES
1
, Contents
1 Problem to Convert Other Time Units to Seconds ............................................................ 3
1.1 Program ............................................................................................................................................................ 3
1.2 Output .............................................................................................................................................................. 3
2 Problem to Convert Seconds to Other Time Units ............................................................ 4
2.1 Program ............................................................................................................................................................ 4
2.2 Output .............................................................................................................................................................. 4
3 Problem to Display Current Time ..................................................................................... 5
3.1 Program ............................................................................................................................................................ 5
3.2 Output .............................................................................................................................................................. 5
4 Problem to Convert Temperature Scales.......................................................................... 5
4.1 Program ............................................................................................................................................................ 5
4.2 Output .............................................................................................................................................................. 6
5 Problem to Add All the Digits in an Integer Number ........................................................ 6
5.1 Program ............................................................................................................................................................ 6
5.2 Output .............................................................................................................................................................. 6
2
DETAILED SOLUTIONS – VOLUME 3
CONVERSION, MEASUREMENT, AND UNIT EXERCISES
1
, Contents
1 Problem to Convert Other Time Units to Seconds ............................................................ 3
1.1 Program ............................................................................................................................................................ 3
1.2 Output .............................................................................................................................................................. 3
2 Problem to Convert Seconds to Other Time Units ............................................................ 4
2.1 Program ............................................................................................................................................................ 4
2.2 Output .............................................................................................................................................................. 4
3 Problem to Display Current Time ..................................................................................... 5
3.1 Program ............................................................................................................................................................ 5
3.2 Output .............................................................................................................................................................. 5
4 Problem to Convert Temperature Scales.......................................................................... 5
4.1 Program ............................................................................................................................................................ 5
4.2 Output .............................................................................................................................................................. 6
5 Problem to Add All the Digits in an Integer Number ........................................................ 6
5.1 Program ............................................................................................................................................................ 6
5.2 Output .............................................................................................................................................................. 6
2