#!/usr/bin/perl
print ("Enter the hour: ");
$hour = <STDIN>;
print ("Enter the minute: ");
$minute = <STDIN>;
$angle = $hour * 30 - $minute * 5.5;
print ("The angle between the hour hand and the minute hand is $angle degrees \n");
Execution
Enter the hour: 3
Enter the minute: 0
The angle between the hour hand and the minute hand is 90 degrees
Enter the hour: 6
Enter the minute: 0
The angle between the hour hand and the minute hand is 180 degrees
Enter the hour: 6
Enter the minute: 15
Enter the minute: 15
The angle between the hour hand and the minute hand is 97.5 degrees
Enter the hour: 6
Enter the minute: 30
Enter the minute: 30
The angle between the hour hand and the minute hand is 15 degrees
Enter the hour: 4
Enter the hour: 4
Enter the minute: 15
The angle between the hour hand and the minute hand is 37.5 degrees
Enter the hour: 4
Enter the hour: 4
Enter the minute: 20
The angle between the hour hand and the minute hand is 10 degrees
No comments:
Post a Comment