Ask Question
21 May, 16:14

Write a fragment of code that will test whether an integer variable score contains a valid test score. Valid test scores are in the range 0 to 100.

+5
Answers (1)
  1. 21 May, 19:15
    0
    Following are the code in the C Programming Language.

    //set integer datatype variable

    int score;

    //check condition is the score is in the range of 0 to 100

    if (score > 0 && score < 100) {

    //print if condition is true

    printf ("Valid test scores");

    }else{

    //otherwise print the following string.

    printf ("test scores are Invalid");

    }

    Explanation:

    Following are the description of the code.

    In the following code that is written in the C Programming Language.

    Set an integer data type variable i. e., score. Then, set the if conditional statement to check the condition is the variable "score" is greater than 0 and less the 100. If the following statement is true then print "Valid test scores". Otherwise, it print "test scores are Invalid".
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a fragment of code that will test whether an integer variable score contains a valid test score. Valid test scores are in the range 0 ...” 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