Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Header file



" ; " after loop



Iterative statement



Comment



Test expression




Function_ convert given total-time into minutes




// AHF C PROGRAM SOLVING

//The problem are solving here using FUNCTION

#include<stdio.h> #include<math.h> #define pf printf //function declaration int minutes(int hrs, int min); void main() { int hrs,min,total; pf("Enter the time in hours: "); scanf("%d",&hrs,); pf("Enter the time in minutes: "); scanf("%d",,&min); //function call total=minutes(hrs,min); pf("\nThe total minutes= %d",total); return 0; } //function definition int minutes(int hrs, int min) //function header //function body { return (60*hrs+min); //calculating output }
OUTPUT:


© 2018 - All rights reserved