B
B
bixoxide2019-02-22 08:28:41
C++ / C#
bixoxide, 2019-02-22 08:28:41

Is the C code not working correctly?

The mass of one water molecule is approximately 3.0x10-23 grams. A quart of water weighs approximately 950 grams. Write a program that prompts you to enter the volume of water in quarts and displays the number of water molecules in that volume.

#include <stdio.h>
int main()
{
    long double molecule,sum;
    int quart,summof;
    printf("type quarts    ");
    scanf("%d",&summof);
    quart = summof * 950;
    molecule = -3e+23 ;
    sum = molecule * quart;
    printf(" %le ",sum);
    return 0;
}

The result of this code is always the same 1.482197e-323. Please tell me what's wrong...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question