Monday, May 16, 2022
Envato Elements
HomeCodingDart Program To Check Pass Or Fail.

Dart Program To Check Pass Or Fail.

Problem Statement

Given the final percentage a student has gotten at the end of a semester, you need to write a program that decides if the student has passed or failed the semester.
If the percentage is higher than or equal to 60, the student has passed the semester. If the percentage is lower than 60, the student has failed the semester.
However, the percentage is not the only thing that determines if a student has passed or failed. A student does not pass if their score is 5 points below the class average.
For instance, if the average class score is 70, the student must have a minimum score of 65 to pass.
If the average class score is 50, the student still needs a score of 60 to pass based on our first condition.
The average has already been declared for you.

Input

The input will be the variable percentage that stores the final percentage the student received.
The percentage has already been declared for you.

Output

The output should be pass if the student has a percentage higher than or equal to 60 while also being 5 within the average class score, otherwise, it would be fail.
The result should be displayed as output.

Example

Sample Input

81

Sample Output

pass

Program

void main() {
	var percentage, classAverage, points;
  percentage = 81;
  classAverage = 70;
  points = classAverage - percentage;
  if(points <=5 && percentage >= 60)
  {
    print("pass");
  }
  else {
    print("fail");
  }
}

OUTPUT:

pass
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments