Here, we have a basic program example to calculate the total number of minutes from a given input using different languages. This program is created in c language, c++, Java, and Python.
Program to calculate total number of minutes in C language
#include<stdio.h>
void main()
{
int hours, mins, total_min;
printf("Enter the hours: ");
scanf("%d",&hours);
printf("Enter the minutes: ");
scanf("%d",&mins);
total_min = hours * 60 + mins;
printf("total minute = %d ", total_min);
}
Program to calculate total number of minutes in C++ language
#include<iostream>
#include<stdlib.h>
#include<cmath>
using namespace std;
int main()
{
int hours, mins, total_min;
cout<<"Enter the hours: ";
cin>>hours;
cout<<"Enter the minutes: ";
cin>>mins;
total_min = hours * 60 + mins;
cout<<"total minutes = " << total_min;
}
Program to calculate total number of minutes in Python language
hours = int(input("Enter the hours: "))
mins = int(input("Enter the minutes: "))
total_min = hours * 60 + mins
print("Total minutes are : ", total_min)
Program to calculate total number of minutes in Java language
import java.util.Scanner;
public class time
{
public static void main(String[] args)
{
int hours, mins, total_mins;
Scanner s = new Scanner(System.in);
System.out.print("Enter the hours: ");
hours = s.nextInt();
System.out.print("Enter the minutes: ");
mins = s.nextInt();
total_mins = hours * 60 + mins ;
System.out.println("Total minutes are : "+total_mins);
}
}