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:

C C++ program to find area and circumference of Circle

C C++ program to find area and circumference of Circle

Procedure Oriented Programming (POP) और Object Oriented Programming (OOP) में अंतर जानने के लिए देखें—POP vs OOP

Object Oriented Programming (OOP) की विभिन्न अवधारणाओं को जानने के लिए देखें—Concepts of OOP

Flowchart to find area and circumference of Circle

Flowchart to find area and circumference of Circle

C program to find area and circumference of Circle

#include<stdio.h>
int main()
{
    float r,a,c;
    printf("Enter radius: ");
    scanf("%f",&r);
    a=3.14*r*r;
    c=2*3.14*r;
    printf("Area = %f",a);
    printf("\nCircumference = %f",c);
    return 0;
}

C++ program to find area and circumference of Circle

#include<iostream>
using namespace std;
int main()
{
    float r,a,c;
    cout<<"Enter radius: ";
    cin>>r;
    a=3.14*r*r;
    c=2*3.14*r;
    cout<<"Area = "<<a<<endl;
    cout<<"Circumference = "<<c<<endl;
    return 0;
}

Output of C C++ program to find area and circumference of Circle

Enter radius: 5
Area = 78.500000
Circumference = 31.400000
Enter radius: 12.5
Area = 490.874000 
Circumference = 78.539800   

Similar most common 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
Share it to:

Write a C C++ program to find number of days in a month

Write a C C++ program to find number of days in a month

If statement और decision making statements के बारे में अधिक जानने के लिए देखें— If statements in C

Switch statement और multibranching statements के बारे में अधिक जानने के लिए देखें—Switch statements in C

Flowchart to find number of days in a month

Flowchart to find number of days in months

C program to find number of days in a month

#include<stdio.h>
int main()
{
    int month;
    printf("Enter month number: ");
    scanf("%d",&month);
    switch(month)
    {
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12:
        printf("31 days");
        break;
        case 4:
        case 6:
        case 9:
        case 11:
        printf("30 days");
        break;
        case 2:
        printf("28 days");
        break;
        default:
        printf("Invalid month number");
    }
    return 0;
}

C++ program to find number of days in a month

#include<iostream>
using namespace std;
int main()
{
    int month;
    cout<<"Enter month number: ";
    cin>>month;
    switch(month)
    {
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12:
        cout<<"31 days";
        break;
        case 4:
        case 6:
        case 9:
        case 11:
        cout<<"30 days";
        break;
        case 2:
        cout<<"28 days";
        break;
        default:
        cout<<"Invalid month number";
    }
    return 0;
}

Output of C C++ program to find number of days in a month

Enter month number: 1
31 days
Enter month number: 6
30 days
Enter month number: 15
Invalid month number

Related programs in C and C++

  1. Absolute value of number (simple if)
  2. Checking odd or even number (if else)
  3. Checking leap year (if else)
  4. Greater in two numbers (if else)
  5. Finding grade from percent (else if ladder)
  6. Total percent and division (else if ladder)
  7. Greatest in three numbers (nested if)
  8. Simple calculator program (switch case single case)
  9. Switch between Mon to Sun (switch case single case)
  10. Checking vowel or consonant (switch case multiple case)
  11. Unconditional Branching (break continue and goto)
Share it to:

Write a simple calculator program in C C++ using switch case

Write a simple calculator program in C C++ using switch case

Switch statement और multibranching statements के बारे में अधिक जानने के लिए देखें—Switch statements in C

Looping और iterative statements के बारे में और अधिक जानने के लिए देखें— Looping statements in C

Flowchart of simple calculator program using switch case

Simple calculator flowchart

Simple calculator program in C using switch case

#include<stdio.h>
int main()
{
    char choice;
    int n1,n2,res;
    printf("Enter choice: ");
    scanf("%c",&choice);
    printf("Enter two numbers: ");
    scanf("%d%d",&n1,&n2);
    switch(choice)
    {
        case '+':
        res=n1+n2;
        break;
        case '-':
        res=n1-n2;
        break;
        case '*':
        res=n1*n2;
        break;
        case '/':
        res=n1/n2;
        break;
        case '%':
        res=n1%n2;
        break;
        default:
        printf("Invalid choice");
    }
    printf("Result = %d",res);
    return 0;
}

Simple calculator program in C++ using switch case

#include<iostream>
using namespace std;
int main()
{
    char choice;
    int n1,n2,res;
    cout<<"Enter choice: ";
    cin>>choice;
    cout<<"Enter two numbers: ";
    cin>>n1>>n2;
    switch(choice)
    {
        case '+':
        res=n1+n2;
        break;
        case '-':
        res=n1-n2;
        break;
        case '*':
        res=n1*n2;
        break;
        case '/':
        res=n1/n2;
        break;
        case '%':
        res=n1%n2;
        break;
        default:
        cout<<"Invalid choice";
    }
    cout<<"Result = "<<res;
    return 0;
}

Output of simple calculator program in C C++ using switch case

Enter choice: +
Enter two numbers: 4 6
Result = 10
Enter choice: %
Enter two numbers: 10 6
Result = 4
Enter choice: #
Enter two numbers: 2 3
Invalid choice
Result = -53446 

Other switch case programs and branching programs in C C++

  1. Absolute value of number (simple if)
  2. Checking odd or even number (if else)
  3. Checking leap year (if else)
  4. Greater in two numbers (if else)
  5. Finding grade from percent (else if ladder)
  6. Total percent and division (else if ladder)
  7. Greatest in three numbers (nested if)
  8. Switch between Mon to Sun (switch case single case)
  9. Checking vowel or consonant (switch case multiple case)
  10. Number of days in a month (switch case multiple case)
  11. Unconditional Branching (break continue and goto)
Share it to:

Write a C C++ program to check leap year

Write a C C++ program to check leap year

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

If statement और इसके विभिन्न प्रकारो को जानने के लिए देखें—If statements in C

Flowchart to check leap year

Finding given year is leap or not flowchart

C program to check leap year

#include<stdio.h>
int main()
{
    int y;
    printf("Enter an year: ");
    scanf("%d",&y);
    if(y%4==0&&y%100!=0||y%400==0)
    {
        printf("Leap year");
    }
    else
    {
        printf("Not a leap year");
    }
    return 0;
}

C++ program to check leap year

#include<iostream>
using namespace std;
int main()
{
    int y;
    cout<<"Enter an year: ";
    cin>>y;
    if(y%4==0&&y%100!=0||y%400==0)
    {
        cout<<"Leap year";
    }
    else
    {
        cout<<"Not a leap year";
    }
    return 0;
}

Output of C C++ program to check leap year

Enter a year: 2020
leap year
Enter a year: 2021
Not a leap year

Other selection logic programs in C C++

  1. Absolute value of number (simple if)
  2. Checking odd or even number (if else)
  3. Greater in two numbers (if else)
  4. Finding grade from percent (else if ladder)
  5. Total percent and division (else if ladder)
  6. Greatest in three numbers (nested if)
  7. Simple calculator program (switch case single case)
  8. Switch between Mon to Sun (switch case single case)
  9. Checking vowel or consonant (switch case multiple case)
  10. Number of days in a month (switch case multiple case)
  11. Unconditional Branching (break continue and goto)
Share it to:

Write a C C++ program to check odd or even number

Write a C C++ program to check odd or even number

C-Language के विभिन्न Control Statements या Programming Constructs को जानने के लिए देखें—Control statements in C

If statement और इसके विभिन्न प्रकारो को जानने के लिए देखें—If statements in C

Flowchart to check odd or even number

Checking whether given number is even or odd flowchart

C program to check odd or even number

#include<stdio.h>
int main()
{
    int n;
    printf("Enter a number: ");
    scanf("%d",&n);
    if(n%2==0)
    {
        printf("Even number");
    }
    else
    {
        printf("Odd number");
    }
    return 0;
}

C++ program to check odd or even number

#include<iostream>
using namespace std;
int main()
{
    int n;
    cout<<"Enter a number: ";
    cin>>n;
    if(n%2==0)
    {
        cout<<"Even number";
    }
    else
    {
        cout<<"Odd number";
    }
    return 0;
}

Output of C C++ program to check odd or even number

Enter a number: 5
Odd number
Enter a number: 72
Even number

Other decision making programs in C C++

  1. Absolute value of number (simple if)
  2. Checking leap year (if else)
  3. Greater in two numbers (if else)
  4. Finding grade from percent (else if ladder)
  5. Total percent and division (else if ladder)
  6. Greatest in three numbers (nested if)
  7. Simple calculator program (switch case single case)
  8. Switch between Mon to Sun (switch case single case)
  9. Checking vowel or consonant (switch case multiple case)
  10. Number of days in a month (switch case multiple case)
  11. Unconditional Branching (break continue and goto)
Share it to:

Write a C C++ program to convert from Celsius to Fahrenheit

Write a C C++ program to convert from Celsius to Fahrenheit

C Language के बारे में अधिक जानने के लिए देखें—Brief Introduction of C

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

Flowchart to convert from Celsius to Fahrenheit

Centigrade to Fahrenheit conversion flowchart

C program to convert from Celsius to Fahrenheit

#include<stdio.h>
int main()
{
    float c,f;
    printf("Enter temperature in celsius: ");
    scanf("%f",&c);
    f = 32+(c*9)/5;
    printf("Temperature in fahrenheit = %f",f);
    return 0;
}

C++ program to convert from Celsius to Fahrenheit

#include<iostream>
using namespace std;
int main()
{
    float c,f;
    cout<<"Enter temperature in celsius: ";
    cin>>c;
    f = 32+(c*9)/5;
    cout<<"Temperature in fahrenheit = "<<f;
    return 0;
}

Output of C C++ program to convert from Celsius to Fahrenheit

Enter temperature in celsius: 37
Temperature in fahrenheit = 98.599998
Enter temperature in celsius: 50
Temperature in fahrenheit = 122.000000

Other related C C++ programs

  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. Find area and circumference of circle
Share it to:

Write a C C++ program to swap without using third variable

Write a C C++ program to swap without using third variable

C Language में उपलब्ध Operators और इनके विभिन्न प्रकारो को जानने के लिए देखें—Operators in C

C-Language में Operator Precedence और Associativity Rule क्या होता है जानने के लिए देखें— Precedence and Associativity in C

Flowchart to swap without using third variable

Swapping without using third variable flowchart

C program to swap without using third variable

#include<stdio.h>
int main()
{
    int a,b;
    printf("Enter a b: ");
    scanf("%d%d",&a,&b);
    a = a+b;
    b = a-b;
    a = a-b;
    printf("a = %d b = %d",a,b);
    return 0;
}

C++ program to swap without using third variable

#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cout<<"Enter a b: ";
    cin>>a>>b;
    a = a+b;
    b = a-b;
    a = a-b;
    cout<<"a = "<<a<<" b = "<<b;
    return 0;
}

Output of C C++ program to swap without using third variable

Enter a b : 10 20
a = 20 b = 10
Enter a b : 18 77
a = 77 b = 18

More C and C++ programs

  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. Celsius to Fahrenheit conversion
  7. Find area and circumference of circle
Share it to:

Write a C C++ program to swap values of two variables

Write a C C++ program to swap values of two variables

C Language में Data type क्या होता है जानने के लिए देखें—Data types in C

C Language में उपलब्ध Operators और इनके विभिन्न प्रकारो को जानने के लिए देखें—Operators in C

Flowchart to swap values of two variables

Swapping values of two variables flowchart

C program to swap values of two variables

#include<stdio.h>
int main()
{
    int a,b,tmp;
    printf("Enter a b : ");
    scanf("%d%d",&a,&b);
    tmp = a;
    a = b;
    b = tmp;
    printf("a = %d b = %d",a,b);
    return 0;
}

C++ program to swap values of two variables

#include<iostream>
using namespace std;
int main()
{
    int a,b,tmp;
    cout<<"Enter a b : ";
    cin>>a>>b;
    tmp = a;
    a = b;
    b = tmp;
    cout<<"a = "<<a<<" b = "<<b;
    return 0;
}

Output of C C++ program to swap values of two variables

Enter a b : 1 2
a = 2 b = 1
Enter a b : 33 54
a = 54 b = 33

Some important C C++ programs of Sequential logic

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

Write a C C++ program to find total and percent

Write a C C++ program to find total and percent

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

C Language में Token क्या होता है जानने के लिए देखें—Tokens in C

Flowchart to find total and percent

Find total and percent flowchart

C program to find total and percent

#include<stdio.h>
int main()
{
    int s1,s2,s3,s4,s5,t;
    float p;
    printf("Enter marks of five subjects: ");
    scanf("%d%d%d%d%d",&s1,&s2,&s3,&s4,&s5);
    t=s1+s2+s3+s4+s5;
    p=t/5.0;
    printf("Total = %d Percent = %f",t,p);
    return 0;
}

C++ program to find total and percent

#include<iostream>
using namespace std;
int main()
{
    int s1,s2,s3,s4,s5,t;
    float p;
    cout<<"Enter marks of five subjects: ";
    cin>>s1>>s2>>s3>>s4>>s5;
    t=s1+s2+s3+s4+s5;
    p=t/5.0;
    cout<<"Total = "<<t<<" Percent = "<<p;
    return 0;
}

Output of C C++ program to find total and percent

Enter marks of five subjects: 40 60 50 90 71
Total = 311 Percent = 62.2
Enter marks of five subjects: 78 45 81 90 66 
Total = 311 Percent = 72.000000

List of similar C and C++ programs

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