TOPIC

Getting 30% error in C#

Rakibul Rafi asked 9 months ago

why i am getting 30% error? Can anyone help me out here is my code: int count = 0; var sum = 0.0;

        do
        {

            var inp = float.Parse(Console.ReadLine());
            if(inp>0.0 && inp <= 10.0)
            {
                Console.WriteLine("nota invalida");
                count++;
                sum = sum + inp;
            }

        }
        while (count!=2);
        var a = sum / (double)2;
        Console.WriteLine("media = "+a.ToString("F2"));

Remember not post solutions. Your post may be reviewed by our moderators.