Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Project_2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] array = new int[3,5];
- int r = 0, s = 1, num;
- int[] sum = new int[3];
- float[] average = new float[4];
- Console.WriteLine("Enter Grades");
- for (int i = 0; i < 3; i++){
- for (int j = 0; j < 5; j++)
- {
- if((i == r ) && (j == 0)){
- array[i, j] = s;
- r++;
- s++;
- }
- else {
- num = int.Parse(Console.ReadLine());
- array[i, j] = num;
- sum[i] += num;
- }
- }
- }
- for (int i = 1; i < 5; i++)
- {
- for (int j = 0; j < 3; j++)
- {
- average[i-1] += array[j, i];
- }
- average[i - 1] /= 4;
- }
- for (int i = 0; i < 3; i++)
- {
- Console.Write("\n");
- for (int j = 0; j < 5; j++)
- {
- Console.Write("{0}\t", array[i, j]);
- }
- Console.Write("\n\n");
- }
- for(int i = 0; i < 3; i++)
- {
- Console.WriteLine("Sum of student {0} = {1}", i+1, sum[i]);
- }
- for(int i= 0; i < 4; i++)
- {
- Console.WriteLine("Average of course {0} = {1}", i+1, average[i]);
- }
- //Console.WriteLine("Sum = {0}\nAverage = {1}", sum, average);
- Console.ReadLine();
- }
- }
- }
Add Comment
Please, Sign In to add comment