FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 53   



Following program shows you how to convert grams to kilograms.
In this program we get grams from user, once we get those we need to divide with 1000 so that we get in kilograms

#include <iostream>
#include <math.h>

int main() {
    float grams;
    std::cout << "Please enter grams:";
    std::cin >> grams;
    float kilograms = grams / 1000;
    std::cout << kilograms << " Kilograms";
}

Output:

Please enter grams: 1000
1 Kilograms



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News