Ad Code

NEW POST

6/recent/ticker-posts

Binita was travelling from chennai to delhi || SRM ELAB DLD

c program

Binita was travelling from chennai to delhi


CODE + EXPLANATION:

#include <stdio.h>  // This line includes a library that provides input/output functions.

int main() {

    // Declare variables to store total minutes, hours, and remaining minutes.

    int tot_mins, hrs, mins;


    // Prompt the user to input a value for total minutes.

    scanf("%d", &tot_mins);


    // Calculate the number of hours and remaining minutes.

    hrs = tot_mins / 60;  // Divide total minutes by 60 to get hours.

    mins = tot_mins % 60;  // Use the remainder operator to get the remaining minutes.


    // Display the result.

    printf("%d Hours and %d Minutes", hrs, mins);


    // Indicate successful completion of the program.

    return 0;

}


Post a Comment

0 Comments