Codechef Problems: Diwali Discount (DIWALIDISC)
Problem Statement:
Solution:
Given,
A : Price of Diwali Gift
B : Voucher Discount Amount
to find: How much money chef has to give for the Diwali gift
condition 1 : A <= B (price of gift is less than or equals to voucher amount)
output : 0
condition 2 : otherwise i.e., A > B (price of gift is greater than voucher amount)
output : A - B
Code Solution
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (a <= b) {
cout << 0 << endl;
} else {
cout << a - b << endl;
}
return 0;
}
Comments
Post a Comment