write a program that reads values representing the weight in kilogram, grams and
ID: 3759114 • Letter: W
Question
write a program that reads values representing the weight in kilogram, grams and kilograms and then prints the equivalent in milligrams ( for example, 1kilogram, 50 grams, and 42 milligrams is equivalent to 10,50,042 milligrams)Using the program eclipse. Please and thank you write a program that reads values representing the weight in kilogram, grams and kilograms and then prints the equivalent in milligrams ( for example, 1kilogram, 50 grams, and 42 milligrams is equivalent to 10,50,042 milligrams)
Using the program eclipse. Please and thank you write a program that reads values representing the weight in kilogram, grams and kilograms and then prints the equivalent in milligrams ( for example, 1kilogram, 50 grams, and 42 milligrams is equivalent to 10,50,042 milligrams)
Using the program eclipse. Please and thank you
Explanation / Answer
#include <iostream>
using namespace std;
int main() {
int kg,gm,mg;
int net=0;
cout<<"Enter kg: ";
cin>>kg;
cout<<"Enter gm: ";
cin>>gm;
cout<<"Enter mg: ";
cin>>mg;
net = kg*1000000 + gm*1000 + mg;
cout<<" Net weight is: "<<net<<" mg";
cout<<" ";
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.