Question

write program in c # to do the following : Insert 10 student scores and store...

write program in c # to do the following :
Insert 10 student scores and store them in an array
Create a function that prints array elements
Create a function that returns the highest mark
Create a function that calculates the average score
Create a function that calculates the pass rate, knowing that the pass mark is 60
0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts please comment below. Please give upvote if you like this.

C# Code :

using System.IO;
using System;
using System.Linq;

class Program
{
//Method for Display array
static void printArray( float[] Marks)
{
//Prompt for user
Console.Write("Array Elements :");
//Loop for itterate array elements
foreach( float i in Marks)
{
Console.Write(i+" ");// Display the result
}
}
// Method for Calcute heighest marks
static float heighestMarks(float[] Marks)
{
return Marks.Max(); //return Max marks
}
//Method to calculate average
static double AverageScore(float[] Marks)
{
return (double)(Marks.Sum()/10);; //Return Average
}
//Method for calculate Pass rate
static double PassRate(float[] Marks)
{
float PassSum = 0;//Instalise variable with 0
//Loop itterate array elements
foreach(float i in Marks)
{
//Condition for pass marks
if( i >= 60 )
{
PassSum += i; // Calculate paas sum >=60
}
}
//Return pass rate
return ((double)(PassSum / Marks.Sum()))*100;
}
  
//Main method
static void Main()
{
//Instalise 10 student marks
float[] Marks = { 98, 67, 76, 54, 87, 33, 57, 90, 100, 21 };
//call PrintArray method to print array
printArray(Marks);
// Call the method heighestmarks and display that
Console.Write("\nHeighest Marks is : "+ heighestMarks(Marks));
// Call the method AverageScore and display that
Console.Write("\nAverage Marks is : "+ AverageScore(Marks));
// Call the method PassRate and display that
Console.Write("\nPass Rate is : "+ PassRate(Marks));
}
}

using System.IO; 2 using System; using System.Linq; 4 5 class Program 7 8 9 10 { // Method for Display array static void prin

//Method for calculate Pass rate static double PassRate( float[] Marks) { 28 29 30 31 32 33 34 35 36 37 38 float Passsum 0;//

Array Elements :98 67 76 54 87 33 57 90 100 21 Heighest Marks is : 100 Average Marks is : 68.3 Pass Rate is : 75.841874084919

Add a comment
Know the answer?
Add Answer to:
write program in c # to do the following : Insert 10 student scores and store...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT