Codechef Problems : Happy New Year! (NEWYEAR)
Problem Statement:
Currently, it is hours on December and you are wondering how many hours are left till midnight.
For the purposes of this problem, we use a hour system. So, can range from to , and you need to tell the number of hours left till of the next day.
Input Format
- The first and only line of input contains a single integer .
Output Format
For each test case, output on a new line the number of hours left till midnight
Constraints
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
Post a Comment