SoFunction
Updated on 2025-03-06

C# method for calculating weighted average scores based on process-oriented

This article describes the method of C# to calculate weighted average scores based on process-oriented. Share it for your reference. The details are as follows:

using System;
using ;
using ;
using ;
namespace ConsoleApplication1
{
 class Program
 {
  static void Main(string[] args)
  {
   ("Enter your total number of courses:");
   int score_number = 0;
   string score_temp = ();
   score_number = Convert.ToInt32(score_temp);
   double[] score;
   score = new double[score_number];
   double[] unit;
   unit = new double[score_number];
   double sum = 0;
   double total_credit=0;
   ("Please enter your scores:");
   for (int i = 0; i <= score_number-1;i++ )
   {
    string temp=();
    score[i] = (temp);
   }
   ("Please enter your weights:");
   for (int i = 0; i <= score_number-1;i++ )
   {
    string temp = ();
    unit[i] = (temp);
   }
   for (int i = 0;i <= score_number-1;i++)
   {
    sum =sum+(score[i] * unit[i]);
   }
   for (int i = 0; i <= score_number-1;i++ )
   {
    total_credit = total_credit + unit[i];
   }
   double result = 0;
   result = sum / total_credit;
   ("Your weighted rating is equal to:");
   (result);
   ();
  }
 }
}

I hope this article will be helpful to everyone's C# programming.