Sunday, 15 June 2014

C++ program to convert pounds to kilograms and vice versa

Here are C++ programs to convert pounds to kilograms and vice versa. First program converts pounds to kilograms and second program converts kilogram to pound.


C++ program to convert pounds to kilograms
#include<iostream>
using namespace std;
int main()
{
    float kilogram,pound;
    cout<<"Enter pound ";
    cin>>pound;
    kilogram=pound*.454;
    cout<<pound<<" pound = "<<kilogram<<" kg";
    return 0;
}

OUTPUT




C++ program to convert kilogram to pound
#include<iostream>
using namespace std;
int main()
{
    float kilogram,pound;
    cout<<"Enter kilogram ";
    cin>>kilogram;
    pound=kilogram*2.21;
    cout<<kilogram<<" kg = "<<pound<<"pound";
    return 0;
}

OUTPUT

No comments:

Post a Comment