Codechef Problems: Selling Sandwiches (SANDWSHOP)
Problem Statement
Chef sells sandwiches for a living. Each sandwich is sold for rupees.
Chef also needs to buy the ingredients to make a sandwich. The sandwich buns cost rupees, and the vegetables cost rupees. Let us assume that there are no other costs for Chef right now.
What is the profit Chef makes in selling one sandwich? It may be possible that the answer is negative to indicate that Chef makes a loss instead.
Input Format
- The first and only line of input contains integers - and .
Output Format
For each test case, output on a new line the profit or loss Chef makes in selling one sandwich.
Constraints
Solution:
given,
A : Income by Selling Sandwiches
B : Cost of Sandwich Buns
C : Cost of Vegetables
So, Final Profit = Income - Cost = A - ( B + C )
Code Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << a - b - c << endl;
return 0;
}
Comments
Post a Comment