Lab 04 Selection Statements: All Scripts Should Be Stored in Your Firstlastname Folder and Have Clear Names
Lab 04 Selection Statements: All Scripts Should Be Stored in Your Firstlastname Folder and Have Clear Names
4. Write a program that reads an array of length 8 and split it into two arrays; one has the odd elements and the other has the even elements Input: Enter an array of length 8: [1 7 8 9 4 Output: Odd elements = [1 7 9 9] Even elements = [8 4 6 4] 6 4 9]
Lab 04
1/2
Cairo University Faculty of Engineering Credit Hour System GENN004 5. Write a program that reads the departure time of a train and the arrival time and computes and displays the trip time. (Try also departure 12:30 and arrival 13:40) Input: Enter departure hour: 10 Enter departure min: 50 Enter arrival hour: 12 Enter arrival min: 20 Output: Trip time = 1 hr and 30 min 6. Write a program that reads your birth date and todays date and computes and displays your age. (Try also DOB 7/1994 and Today 9/2012) Input: Enter DOB year: 1990 Enter DOB month: 10 Enter date year: 2012 Enter date month: 9 Output: You are 21 years and 11 months old
Lab 04
2/2