Codechef Problems: Chef Bakes Cake 1 (BAKECAKE1)

 Problem Statement: 


Solution: 

Given, 
    N : cakes made by chef 
    M : cakes sold by chef 
    30 : Cost of making a cake 
    50 : Selling price of cake 

to find: Chef's profit 

profit = sell - cost 
          = (M * 50) - (N * 30) 

Code Solution: 

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;

    cout << (m * 50) - (n * 30) << endl;
    return 0;
}

Comments