Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Linq;
- class Program
- {
- public static void Main()
- {
- string FilePath = Console.ReadLine();
- while (File.Exists(FilePath) == false)
- {
- Console.WriteLine("File not found, enter a vaild file path.");
- FilePath = Console.ReadLine();
- }
- string FileContent = File.ReadAllText(FilePath);
- Console.WriteLine("Grades are: {0}", FileContent);
- int resultA = FileContent.Count(c => c == 'A');
- int resultB = FileContent.Count(c => c == 'B');
- int resultC = FileContent.Count(c => c == 'C');
- int resultD = FileContent.Count(c => c == 'D');
- int resultE = FileContent.Count(c => c == 'E');
- int resultF = FileContent.Count(c => c == 'F');
- Console.WriteLine("{0}", resultA);
- Console.ReadLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement