Calculate the IST : Indian Standard Time | C ++ implementation of the approach ; Function to calculate Indian Standard Time ; Separate integer part ; Separate float part and return ceil value ; Driver code ; Number of hours ( 1 - 24 ) ; Rotations in degrees
#include <cmath> NEW_LINE #include <iostream> NEW_LINE using namespace std ; void cal_IST ( int h , float r ) { float IST = ( h * r * 1.0 ) / 360 ; int int_IST = ( int ) IST ; int float_IST = ceil ( ( IST - int_IST ) * 60 ) ; cout << int_IST << " : " << float_IST ; } int main ( ) { int h = 20 ; float r = 150 ; cal_IST ( h , r ) ; return 0 ; }