Ask Question
12 January, 22:49

How to write (c program) code for 30/4 = 7.5. It should print 7.5, not 7

+5
Answers (1)
  1. 13 January, 00:53
    0
    The program to given question for get the output 7.5. We write the code like this

    #include

    int main () / /define main method

    {

    float a; / /declare a float variable.

    a=30.0/4; / /a holding the value

    printf ("the value of a = %f", a); / /print the value.

    return 0;

    }

    output:

    7.500000

    Explanation:

    In the above program we declare a variable (a). That's datatype is float because float datatype hold the decimal values. Then we assign the value to variable a that is already given in the question. Then we print the value by using printf () function.

    So the output of the given question is 7.5.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “How to write (c program) code for 30/4 = 7.5. It should print 7.5, not 7 ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers