Menu
Coddy logo textTech

Video Game

Lesson 6 of 25 in Coddy's Coding Problems: Volume 2 course.

You bought a new game and the scoring works by passing different levels in the game. If you pass a level of difficulty 1 you get points D1, if you pass a difficulty 2 you get points D2, and so on. Create a program that calculates the total amount of points if you are given the total amount of levels passed, and the first three levels are of difficulty 1, the next four are difficulty 2 and the rest are difficulty 3

challenge icon

Challenge

Easy

Write a program that reads 3 natural numbers from input D1, D2, and D3 that represent the points rewarded for each difficulty and in the next row it reads the total number of levels passed

Input
300 450 600
9

Output
3900

Explanation
First three, 3 * 300 = 900, next four, 4 * 450 = 1800, and the remaining two, 2 * 600 = 1200, a total of 3900

Try it yourself

#include <stdio.h>

int main() {
    // Write code here
    return 0;
}

All lessons in Coding Problems: Volume 2