Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to compute total minutes from given hours and minutes

Posted By: Charlie Evans     Category: C Programming     Views: 4926

Write a program to compute total minutes from given hours minutes.

Code for Program to compute total minutes from given hours and minutes in C Programming

#include<stdio.h>

void main()
{

        int hour,minute,minute1,total;
        printf("Hrs:");
        if(scanf("%d",&hour)==1)
        {
                printf("Mins:");
                if(scanf("%d",&minute)==1)
                {
                        minute1=hour*60;
                        total=minute1+minute;
                        printf(" total minutes=> %d",total);
                }
                else
                {
                        printf("error ,enter correct value");
                }
        }
        else
        {
                printf("Error,enter correct value");
        }

}


================================OUTPUT===========================
Hrs :12
Mins:30
Total minutes=> 750
  
Share: 



Charlie Evans
Charlie Evans author of Program to compute total minutes from given hours and minutes is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!