Skip to content
DATA STRUCTURE
DATA STRUCTURE

Learn everything about Data structure

  • Algorithms
  • DSA
  • Array
  • Stack
  • Queue
  • Matrix
  • Programs
DATA STRUCTURE

Learn everything about Data structure

Algorithm to input percentage from user and print grade

YASH PAL, September 24, 2022March 6, 2023

In this tutorial, we will write an algorithm to input percentages from users and print grades. using this algorithm we can write a program to input percentages from users and print grades in most programming languages like java, python, c++, and c programming.

[br]

Algorithm to input percentage from user and print grade.

1. Read P.
2. If P >= 90, then:
3.   Set GRADE:=’A’.
4. Else If P >= 70, then:
5.   Set GRADE:=’B’.
6. Else If P>=50, then:
7.   Set GRADE:=’C’.
8. Else:
9.   Set GRADE:=’F’.
10. [End of If Else Structure]
11. Write GRADE.
12. Exit
[br]
In the above algorithm first, we read the value of variable P as a percentage and we check if the value of P is greater than 90 then set the value of the GRADE variable to A else we check if the value of P is greater than 70 but less than 90 then we set the value of GRADE variable to B else we check if the value of P is greater than 50 but less than 90 then we will set the value of GRADE to C else we will set the value of GRADE to F. after completing the If-Else statement we write a value of GRADE to the output screen and then exit from the program.
[br]
Also, Read
  1. Algorithm to Add [Sum] two numbers
  2. Algorithm to Find Maximum of Two Numbers
  3. Algorithm to Find Maximum of Three Numbers
  4. Algorithm to Print the Series 1 to N using for loop
  5. Algorithm to Print the Series 1 to N using while loop
  6. Algorithm to Print the Series 1 to N using Do While loop
  7. Algorithm to Reverse a given Number
  8. Algorithm to Find Whether a Number is Prime or Not
  9. Algorithm for Linear Search in Array
  10. Algorithm to Calculate Factorial using Function
algorithms algorithm

Post navigation

Previous post
Next post

Leave a Reply

Your email address will not be published. Required fields are marked *

  • HackerRank Dynamic Array Solution in Python
  • HackerRank 2D Array DS solution in Python
  • HackeRank Array – DS solution in Python
  • Streaming Demystified: How Much Data Does Your Favorite Show Really Use?
  • Parenthesis Matching program in C programming
  • HackerRank Dynamic Array Solution in Python
  • HackerRank 2D Array DS solution in Python
  • HackeRank Array – DS solution in Python
  • Streaming Demystified: How Much Data Does Your Favorite Show Really Use?
  • Parenthesis Matching program in C programming
  • About US
  • Contact US
  • Data Structures and algorithms tutorials
  • Digital Communication Tutorials
  • DMCA
  • HackerRank All Algorithms problems solutions
  • HackerRank C problems solutions
  • HackerRank C++ problems solutions
  • HackerRank Java solutions
  • HackerRank Python solutions
  • Human Values Tutorials
  • Internet of Things Tutorials
  • Privacy Policy
©2025 DATA STRUCTURE | WordPress Theme by SuperbThemes