Programming in C Write a program that reads 43 numbers of va
Programming in C#
Write a program that reads 43 numbers of values between 1 and 10 from a data file or keyboard. Display a frequency distribution bar chart of those numbers. Use asterisks to show the number of times each value was entered. If a given number is not entered, no asterisks should appear on that line. Your application should display error messages if a value outside the acceptable range is entered or if a non-numeric character is entered.
Solution
Here is the code for you:
using System.IO;
 using System;
class Program
 {
 static void Main()
 {
 int []digits = new int[11];
 for(int i = 0; i < 43; i++)
 digits[i] = 0;
 Console.WriteLine(\"Enter the digits followed by a sentinal value -1:\");
 int count = 0;
 int num = Convert.ToInt32(Console.ReadLine());
 while(num != -1 && count < 43)
 {
 if(num > 10)
 {
 Console.WriteLine(\"Invalid number.\");
 break;
 }
 digits[num]++;
 count++;
 num = Convert.ToInt32(Console.ReadLine());
 }
 for(int i = 1; i <= 10; i++)
 {
 for(int j = 0; j < digits[i]; j++)
 Console.Write(\"* \");
 Console.WriteLine();
 }
 }
 }

