Grade from Marks

Grade from Marks

Easy PHP PHP Control Flow 18 views
Explanation Complexity

Problem Statement

Given marks (0..100), print grade: A(90+), B(80-89), C(70-79), D(60-69), else F.

Input Format

One integer marks.

Output Format

One letter grade.

Example

85
B

Constraints

0

Input / Output Format

Input Format
One integer marks.
Output Format
One letter grade.
Constraints
0

Examples

Input:
85
Output:
B

Example Solution (Public)

PHP
<?php
$inputText=trim(stream_get_contents(STDIN));
if($inputText==='') exit;
$m=intval($inputText);
if($m>=90) echo 'A';
elseif($m>=80) echo 'B';
elseif($m>=70) echo 'C';
elseif($m>=60) echo 'D';
else echo 'F';
?>

Official Solution Code

<?php
$inputText=trim(stream_get_contents(STDIN));
if($inputText==='') exit;
$m=intval($inputText);
if($m>=90) echo 'A';
elseif($m>=80) echo 'B';
elseif($m>=70) echo 'C';
elseif($m>=60) echo 'D';
else echo 'F';
?>
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.