Program to find minimum number of lectures to attend to maintain 75 % | C ++ Program to find minimum number of lectures to attend to maintain 75 % attendance ; Function to compute minimum lecture ; Formula to compute ; Driver function
#include <cmath> NEW_LINE #include <iostream> NEW_LINE using namespace std ; int minimumLectures ( int m , int n ) { int ans = 0 ; if ( n < ( int ) ceil ( 0.75 * m ) ) ans = ( int ) ceil ( ( ( 0.75 * m ) - n ) / 0.25 ) ; else ans = 0 ; return ans ; } int main ( ) { int M = 9 , N = 1 ; cout << minimumLectures ( M , N ) ; return 0 ; }