Codechef Problems: Popcorn Buying (POPCORN7)

 Problem Statement:

Solution: 

Given X: be the amount of money chef has (X >= 100)

part 1: Deduction of ticket money (ticket price : 50rs)

Y: Remaining Money 
Y = X - 100 

part 2: No of popcorn baskets he can buy 

Integer value of  (Y/50) because each popcorn basket costs 50rs. 

Code Solution: 

#include <bits/stdc++.h>
using namespace std;

int main() {
    int x; 
    cin >> x; 
    
    int y = (x - 100) / 50; 
    cout << y << endl; 
    return 0; 
}

Comments