Ask Question

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

+3
Answers (1)
  1. 31 July, 18:48
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers