Ask 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 to 100.

+5
Answers (1)
  1. 30 August, 11:40
    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 & 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