Phone Company
Lesson 7 of 25 in Coddy's Coding Problems: Volume 2 course.
Create a program that calculates the total price of a phone call between two numbers. Calculate the price if you know that the first 30 minutes is $3 a minute, and after that is $2 a minute. Additionally, if the phone numbers are from the same operator give the price a 30% discount
Operator1 uses numbers that start with 808, 809, 810
Operator2 uses numbers that start with 705 706 707
Challenge
EasyWrite a program that reads two 9-digit numbers each in a separate row, and in the following row a number representing the minutes of the call. Output the total price of the call in $
Input
808419552
810129224
45
Output
$84
Explanation
For the first 30 minutes of the call the phone company charged $3 a minute, the next 15 minutes, it charged $2 a minute, 3 * 30 + 2 * 15 = 120. And adding a 30% discount to 120 makes it 84
Try it yourself
#include <stdio.h>
int main() {
// Write code here
return 0;
}
All lessons in Coding Problems: Volume 2
1Course Introduction
Introduction2Easy Difficulty
GPAEven / Odd SumAverage ValueTaxingVideo GamePhone CompanyCinemaDateString Conversion