#!/usr/bin/perl
print ("What is the result if 37 is added to 45 ? \n");
$correct_ans = 82;
$accept_input = <STDIN>;
chop ($accept_input);
until ($accept_input == $correct_ans)
{
print ("Wrong !!! Keep trying until you get it right....... \n");
$accept_input = <STDIN>;
chop ($accept_input);
}
print ("Yes, you got it right. The correct answer is 82. \n");
Execution
What is the result if 37 is added to 45 ?
37
Wrong !!! Keep trying until you get it right.......
78
Wrong !!! Keep trying until you get it right.......
63
Wrong !!! Keep trying until you get it right.......
89
Wrong !!! Keep trying until you get it right.......
81
Wrong !!! Keep trying until you get it right.......
82
Yes, you got it right. The correct answer is 82.
No comments:
Post a Comment