Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MarksAvgCalculator
- {
- class Program
- {
- static void Main(string[] args)
- {
- double marksTotal = 0;
- int i = 0;
- string exit = "no";
- while (exit != "true")
- {
- i++;
- Console.WriteLine("Please enter mark:");
- double mark = double.Parse(Console.ReadLine());
- marksTotal += mark;
- Console.WriteLine("Would you like to insert another mark?");
- Console.WriteLine("y/n");
- string yN = Console.ReadLine();
- if (yN == "y")
- Console.WriteLine();
- else if (yN == "n")
- {
- Console.WriteLine();
- exit = "true";
- }
- else
- Console.WriteLine("Invalid choice.");
- Console.WriteLine();
- }
- Console.WriteLine("grades average is " + marksTotal / i);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement