C Language Programming Notes – Examples of Using scanf and Arithmetic Operators
Example 1: Input a time duration (in minutes) from the keyboard and calculate how many hours and minutes that duration corresponds to.(1) Source Code #include <stdio.h> #include <stdlib.h> int main(){ int a,b,c; printf("Please enter a time duration (in minutes):"); scanf("%d",&a); b=a/60; c=a%60; printf("%d minutes is equivalent to %d hours and %d minutes\n",a,b,c); return 0;} (2) … Read more