Ask Question
12 April, 16:03

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

+4
Answers (1)
  1. 12 April, 19:51
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers