In: Computer Science
In a college, students are awarded a pass grade if their total mark is between 50-59, credit grade if the mark is between 60-69, distinction for marks between 70-79. High distinction if the mark is above or equal to 80 and fail if the mark is below 50.
The Pseudocode for above problem :
NOTE: The input must be in range 0-100 or else unexpected output will be thrown by program.
ALGORITHM (PSEUDOCODE)
Get MARKS from input
function (MARKS)
        if MARKS >= 80 do
                GRADE = "High Distinction"
        else if MARKS >= 70 do
                GRADE = "Distinction"
        else if MARKS >= 60 do
                GRADE = "Credit"
        else if MARKS >= 50 do
                GRADE = "Pass"
        else do
                GRADE = "Fail"
return GRADE
The solution (program structure) in C (since no language is provided):
#include <stdio.h>  // used for functions like scanf anf printf
#include <stdlib.h>       // used for malloc function to allocate memory.
char* function(int Marks);      // function declaration here
// main function where execution starts.
int main()
{
        int Marks;      // integer variable to store marks from user input
        printf("Marks: ");      // outputs text before taking marks.
        scanf("%d", &Marks);        // takes input and stores in variable
        char *grade = function(Marks);  // function called to get grade evaluated and stored in pointer
        printf("Grade: %s\n", grade);   // prints grade on output screen
        return 0;       // program ends here
}
char* function(int Marks)       // function defination, control comes here when function is called
{
        char *grade = malloc(sizeof(char)*20);  // memory allocated to store grade.
        // if-else statements to calculate grade according to range.
        if (Marks >= 80)     // range: 80-100
                grade = "High Distinction";
        else if (Marks >= 70)        // range: 70-80
                grade = "Distinction";
        else if (Marks >= 60)        // range: 60-70
                grade = "Credit";
        else if (Marks >= 50)        // range: 50-60
                grade = "Pass";
        else                                    // range: 0-50
                grade = "Fail";
        return grade;   // returns grade to main function.
}
Code Screenshot for Indentation:

Sample Output:

Hope it helps.