programming
posted by steve
Consider the following selection statement where X is an integer test score between 0 and 100.
input X
if (0<=X and X<49)
Output "you fail"
Else if (50<=X and X <70)
Output "your grade is" X
Output " you did OK"
Else if (70<=X and X<85)
Output "your grade is"X
Output "you did well"
Else if (85<=X and X<100)
Output "your grade is X
Output "You did great"
Endif
Output "how did you do?"
What will be printed if the input is 0?

MathMate
"What will be printed if the input is 0?"
As a programmer, you would following each statement of the ifthenelse statement and see where the conditions will be satisfied. Follow what it does (prints) after that.
If you start from the top, you won't have very far to go before you find the answer if someone gets a zero (i.e. X=0). 
steve
I am still unaware of the answer.

MathMate
100.
"
100 input X
200 if (0<=X and X<49)
300 Output "you fail"
400 Else if (50<=X and X <70)
500 Output "your grade is" X
600 Output " you did OK"
700 ....
"
What will be printed if the input is 0?
You have input the value of X in line 100. It will then execute line 200.
After line 200 has been executed, if the input value of X = 0, which is the next line the program will execute?
Make a guess from the context if you have to.
The ifthenelse statement branches according to the condition tested.
In the case of line 200, it tests the value of x=0, if the condition is true, it will execute the next statement (and then jump to after the endif statement), otherwise it goes to the next else or elseif statement, and so on.
If you need more details, explain where the problem is, or explain how you think it works, so we can better help you.
Respond to this Question
Similar Questions

programming
Can You Please help me understand how to do this and what i have to do to solve the problem.... Please!! Consider the following selection statement where X is an integer test score between 0 and 100. input X if (0 <= X and X < … 
Help Help
Consider the following selection statement where X is an integer test score between 0 and 100. input X if (0 <= X and X < 49) output "you fail" else if (50 <= X and X < 70) output "your grade is" X output "you did OK" else … 
Part 1
input X if (0 <= X and X < 49) output "you fail" else if (50 <= X and X < 70) output "your grade is" X output "you did OK" else if (70 <= X and X < 85) output "your grade is" X output "you did well" else if (85 <= … 
Part 1
Consider the following selection statement where X is an integer test score between 0 and 100. input X if (0 <= X and X < 49) output "you fail" else if (50 <= X and X < 70) output "your grade is" X output "you did OK" else … 
Algorithm
Algorithm Verification Consider the following selection statement where X is an integer test score between 0 and 100. input X if (0 <= X and X < 49) output "you fail" else if (50 <= X and X < 70) output "your grade is" … 
programming
I am in IT/210 and am having problems with the entire class. But what I am stuck on is as follows: Consider the following statement where X is an integer test score between 0 and 100. input X if (<0=X and X<49) output = "you … 
Math
Hey, I need your help! I have an input output table that I need the function rule for. The table is like this: Input: 0 Output: 25 Input: 100 Output: 35 Input: 200 Output: 45 Input: 300 Output: 55 Input: 400 Output: 65 PLEASE I NEED … 
5th grade math
Using input output tables input 3 4 5 6 0 10. Output 9 16 25 36 0 100 what is the input output rule? 
Computer Science
What is the rule for this function? input 1 output 2 input 2 output 5 Input 3 output 12 Input 4 output 34 Input 5 output 135 Input 6 output 741 
Math
Input: 100 Output 10 Input: 30 Output 3 Input: 70 Output 7 Input: 40 Output 4 Input: 50 Output 5 What is the equation to show the relationship between the input and the output?