Connect with one of the following accounts


Please wait while we redirect...

Views: 226   

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 <stdio.h>

int main(void) {
    float grams;

    printf("Please enter grams:");
    scanf("%f", &grams);

    float kilograms = grams / 1000;

    printf("%f Kilograms", kilograms);


Please enter grams: 2000
2.000000 Kilograms

On By

Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News