C C++ program to convert hours into minutes and seconds

Write a C C++ program to convert hours into minutes and seconds

C Language की विशेषताओं एवं शक्तियों को जानने के लिए देखें—Features and Powers of C

C Language में Character set क्या होता है जानने के लिए देखें—Character set of C

Flowchart to convert hours into minutes and seconds

Flowchart to convert hours into minutes and seconds

C program to convert hours into minutes and seconds

#include<stdio.h>
int main()
{
    float h,m,s;
    printf("Enter time in hours: ");
    scanf("%f",&h);
    m=h*60;
    s=h*3600;
    printf("Minutes = %f Seconds = %f",m,s);
    return 0;
}

C++ program to convert hours into minutes and seconds

#include<iostream>
using namespace std;
int main()
{
    float h,m,s;
    cout<<"Enter time in hours: ";
    cin>>h;
    m=h*60;
    s=h*3600;
    cout<<"Minutes = "<<m<<" Seconds = "<<s;
    return 0;
}

Output of C C++ program to convert hours into minutes and seconds

Enter time in hours: 2
Minutes = 120 Seconds = 7200
Enter time in hours: 5
Minutes = 300 Seconds = 18000

Similar important programs in C C++

  1. Sum of two entered numbers
  2. Average of three entered numbers
  3. Simple interest
  4. Total and Percent
  5. Swapping values of two variables
  6. Swapping without using third variable
  7. Celsius to Fahrenheit conversion
  8. Find area and circumference of circle
Share it to:

Published by

admin

I am a computer teacher, programmer and web developer