Prompt
Answer
Pseudo Code: Finding Maximum and Minimum Marks of Students
Objective
To create a program that accepts the marks of 20 students and outputs the maximum and minimum marks from the entered data.
Inputs and Outputs
- Input: Marks of 20 students
- Output: Maximum marks, Minimum marks
Pseudo Code
Initialize Variables
- Create a list
marks
to store marks of students. - Set
max_marks
to a very low number (e.g., negative infinity). - Set
min_marks
to a very high number (e.g., positive infinity).
- Create a list
Input Marks
- For
i
from 1 to 20 (inclusive):- Prompt user for input: "Enter marks for student i:"
- Read input and convert to integer.
- Append the input marks to the
marks
list.
- For
Calculate Maximum and Minimum Marks
- For each
mark
inmarks
:- If
mark
is greater thanmax_marks
:- Set
max_marks
tomark
.
- Set
- If
mark
is less thanmin_marks
:- Set
min_marks
tomark
.
- Set
- If
- For each
Output Results
- Print "Maximum Marks: " followed by
max_marks
. - Print "Minimum Marks: " followed by
min_marks
.
- Print "Maximum Marks: " followed by
Final Notes
- Ensure that the program handles invalid inputs (non-numeric values) appropriately.
- Consider adding functionality to display all entered marks if required.
Example Code Snippet (In Python)
# Initialize variables
marks = []
max_marks = float('-inf')
min_marks = float('inf')
# Input marks
for i in range(1, 21):
mark = input(f"Enter marks for student {i}: ")
mark = int(mark) # Ensure the input is an integer
marks.append(mark)
# Check for maximum and minimum
if mark > max_marks:
max_marks = mark
if mark < min_marks:
min_marks = mark
# Output results
print("Maximum Marks:", max_marks)
print("Minimum Marks:", min_marks)
This pseudo code should guide the implementation of a program to determine the highest and lowest marks among 20 students effectively.
Description
A program that takes the marks of 20 students, calculates the maximum and minimum marks, and outputs these values, while also handling input validation for non-numeric entries.
More Pseudo Code Generators
Apache Flink Pseudo Code Generator Apache Pig Pseudo Code Generator Azure Data Factory Pseudo Code Generator C/C++ Pseudo Code Generator CouchDB Pseudo Code Generator DAX Pseudo Code Generator Excel Pseudo Code Generator Firebase Pseudo Code Generator Google BigQuery Pseudo Code Generator Google Sheets Pseudo Code Generator GraphQL Pseudo Code Generator Hive Pseudo Code Generator Java Pseudo Code Generator JavaScript Pseudo Code Generator Julia Pseudo Code Generator Lua Pseudo Code Generator M (Power Query) Pseudo Code Generator MATLAB Pseudo Code Generator MongoDB Pseudo Code Generator Oracle Pseudo Code Generator PostgreSQL Pseudo Code Generator Power BI Pseudo Code Generator Python Pseudo Code Generator R Pseudo Code Generator Redis Pseudo Code Generator Regex Pseudo Code Generator Ruby Pseudo Code Generator SAS Pseudo Code Generator Scala Pseudo Code Generator Shell Pseudo Code Generator SPSS Pseudo Code Generator SQL Pseudo Code Generator SQLite Pseudo Code Generator Stata Pseudo Code Generator Tableau Pseudo Code Generator VBA Pseudo Code Generator