Codechef Problems: Independence Day (INDDAY)
Problem Statement:
Solution:
Given, X : today's date
to find, how many days remaining to independence day or it has already passed
condition 1 : X <= 15 i.e., independence day has not passed
output: 15 - X
condition 2 : X > 15 i.e., independence day has passed
output: -1
Code Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
int x;
cin >> x;
if (x <= 15) {
cout << 15 - x << endl;
} else {
cout << -1 << endl;
}
return 0;
}
Comments
Post a Comment