Array and Strings – Arithmetic – Problem #10
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Problem Statement
Write a program to read scores (an integer within [0,100]) of a subject for N (to be read) students in a class. Compute the mean(μ) and standard deviation (σ) of the distribution and print them. The students are graded according to the following policy. Suppose x is the score of a student then the grade awarded to the student would be as follows: EX, if x > μ + 1.5* σ A, if μ + 0.5* σ < x < μ + 1.5* σ B, if μ - 0.5* σ < x < μ + 0.5* σ C, if μ - σ < x < μ - 0.5* σ D, if μ – 1.5* σ < x < μ - σ P, if μ – 2* σ < x < μ - 1.5* σ F, if x < μ – 2* σ In the output file, print the mean and standard deviation of the distribution. Print also the list of score and grade for each student in each separate line in the same sequence as they are read. For example, if the input is given in the following form: N=5 45, 23, 80, 20,75 The outputs are printed as follows: Mean=48.6 Standard Deviation=28.15 Marks and grades of students are: 45 B 23 C 80 A 20 D 75 A Provide output for the following input data set. (i) N=10 Students’ scores: 23, 35, 12, 56, 75, 84, 23, 90, 95, 65 (ii) N=20 Students’ scores: 32, 53, 21, 65, 57, 48, 32, 9, 59, 56, 75, 43, 52, 64, 85, 12, 18, 25, 92