Find if the Vacation can be taken or not | C ++ program to find if the Vacation can be taken or not ; Function to find if the Vacation is possible or not ; Find the required number of hours of study ; find the hours of study that can be done if the vacation is taken ; check if the required hours are less than or equal to the hours of study that can be done if the vacation is taken ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int isPossible ( int N , int S , int C , int H , int L , int T ) { int total_time_required = S * C * H ; int available_time_after_vacation = ( N - L ) * T ; if ( available_time_after_vacation >= total_time_required ) return 1 ; return 0 ; } int main ( ) { int N = 12 , S = 5 , C = 8 , H = 3 , L = 2 , T = 20 ; if ( isPossible ( N , S , C , H , L , T ) ) cout << " Yes " << endl ; else cout << " No " << endl ; N = 1 , S = 2 , C = 3 , H = 4 , L = 5 , T = 6 ; if ( isPossible ( N , S , C , H , L , T ) ) cout << " Yes " << endl ; else cout << " No " << endl ; return 0 ; }