Make a program that will input Kilogram, convert it into grams and pounds. Display the equivalent Gram/s and Pounds (1 Kg=1000 grams and 1 Kg = 2.2 pounds. Your program will be terminated if you input zero in the kilogram.
#include <iostream>
using namespace std;
int main()
{
float Kilogram=1;
while(Kilogram>=0){
cout<<"Enter Kilogram (Enter -1 to STOP): ";
cin>>Kilogram;
if(Kilogram>=0){
cout<<Kilogram<<" Kg = "<<(Kilogram*1000)<<" grams\n";
cout<<Kilogram<<" Kg = "<<(Kilogram*2.2)<<" pounds\n\n";
}
}
return 0;
}
Comments
Leave a comment