Codechef Problems: Exun and the Pizzas (EXUNPIZZA)

 Problem Statement: 

https://www.codechef.com/problems/EXUNPIZZA

Solution: 

Given, 
    N : number of pizzas chef is selling 
    K : Pizzas required by Exunites 
    R : Selling price of each pizza 

to find: income of chef after selling remaining pizzas 

remaining pizzas = number of pizzas chef was selling - number of pizzas required by xunites 
                            = N - K 

Income by selling remaining pizzas = number or remaining pizzas * price of each pizza 
                                                          = (N - K) * R 

Code Solution: 

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, k, r;
    cin >> n >> k >> r;

    cout << (n - k) * r << endl;
    return 0;
}

Comments