Codechef Problems : Happy New Year! (NEWYEAR)

 Problem Statement: 


Solution: 

Given, X : current time in hour on December 31st. 
To Find: Remaining time for New year i.e., 0 hour of the next day 

we know there are 24 hours in a day and present time is X hour 
so time remaining for 0 hour next day is (24 - X) 

Code Solution: 

#include <bits/stdc++.h>

using namespace std;

int main() {
    int x;
    cin >> x;

    cout << 24 - x << endl;
    return 0;
}

Comments