0% found this document useful (0 votes)
109 views

M1-Assignment Solution-Algorithm

The document outlines algorithms for a report card generator app. It begins with a rough algorithm to get the big picture of requirements. This includes declaring variables, welcoming the user, getting input, computing total marks and grade, and generating the report card. It then provides a detailed algorithm converting the rough one for accuracy. This includes more specific variable declarations, input handling, conditional statements for grading, and report card generation. The detailed algorithm is meant to avoid mistakes when writing the actual program.

Uploaded by

Raman deep
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views

M1-Assignment Solution-Algorithm

The document outlines algorithms for a report card generator app. It begins with a rough algorithm to get the big picture of requirements. This includes declaring variables, welcoming the user, getting input, computing total marks and grade, and generating the report card. It then provides a detailed algorithm converting the rough one for accuracy. This includes more specific variable declarations, input handling, conditional statements for grading, and report card generation. The detailed algorithm is meant to avoid mistakes when writing the actual program.

Uploaded by

Raman deep
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Algorithm for Report Card Generator App

Writing algorithm helps a programmer to get a big picture of the app requirements. Since, report
card generator app would require a large number of lines of code, we will first write a rough
algorithm and then convert that rough algorithm into a detailed algorithm. The finalized detailed
algorithm will be used as a reference to write the actual C program.

Note: It is not necessary that the algorithm which you have submitted will match with the given
algorithm in this file. The following algorithm is based on the app code solution provided to you.
If you are able to generate the desired final output from your C program using your algorithm
then you can consider your algorithm as correct.

Rough Algorithm
Rough Algorithm is meant to get a big picture of app requirement

Step 1: Declare required variables to store information such as name, section, grade, standard,
total marks secured, and five more variables store marks secured in each subject
Step 2: Print welcome message
Step 3: User input for name, standard, section, and marks secured in all the five subjects
Step 4: Compute total marks secured
Step 5: Terminate the program is the total marks secured is greater than 500 or less than 0
Step 6: Compute grade using if-else conditional statements
Step 7: Generate the report card by writing appropriate print statements using tab characters and
new line characters

Detailed Algorithm
Converting the rough algorithm into a detailed algorithm so as to avoid any mistake while
writing the actual program

Step 1: Declare required variables


- String name
- Characters section and grade
- Integers standard, mathsScore, englishScore, hindiScore, scienceScore, sscScore, and
totalScore
Step 2: Print welcome message
Step 3: User input for name, standard, section, mathsScore, englishScore, hindiScore,
scienceScore, and sscScore
Step 4: Compute totalScore = mathsScore + englishScore + hindiScore + scienceScore +
sscScore
Step 5: Terminate the program if (totalScore > 500) or if (totalScore < 0)
Step 6: Compute grade
- if (totalScore >= 450 && totalScore <= 500) then grade = 'A'
- else if (totalScore >= 400 && totalScore < 450) then grade = 'B'
- else if (totalScore >= 350 && totalScore < 400) then grade = 'C'
- else if (totalScore >= 300 && totalScore < 350) then grade = 'D'
- else if (totalScore >= 200 && totalScore < 300) then grade = 'E'
- else grade = 'F'
Step 7: Generate report card by writing appropriate print statements using tab characters and
new line characters

You might also like