Ask Question
2 February, 10:21

The following code does not work as intended. It is meant to input two test grades and return the average in decimal format: int test1 = scan. nextInt (); int test2 = scan. nextInt (); double average = (test1 + test2) / 2; System. out. println ("Answer: " + average);

Answers (1)
  1. T
    2 February, 13:27
    0
    To return average in Decimal we will use float datatype instead of double.

    Explanation:

    int test1 = scan. nextInt ();

    int test2 = scan. nextInt ();

    float average = (test1 + test2) / 2;

    System. out. println ("Answer: " + average);
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “The following code does not work as intended. It is meant to input two test grades and return the average in decimal format: int test1 = ...” 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
Sign In
Ask Question