Advertisement
Guest User

Dolgozat átlagpontszám

a guest
Feb 7th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.34 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace DogaBekeres
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.Write("Kérem a dolgozatok számát: ");
  14.             int dogaSzam = int.Parse(Console.ReadLine());
  15.             Console.Write("Kérem a minimum pontszámot: ");
  16.             int minPont = int.Parse(Console.ReadLine());
  17.             Console.Write("Kérem a maximum pontszámot: ");
  18.             int maxPont = int.Parse(Console.ReadLine());
  19.             int osszpont=0;
  20.             for (int i = 0; i < dogaSzam;i++ )
  21.             {
  22.                 Console.Write("Kérem a {0}. pontszámot: ", i+1);
  23.                 int mostani = int.Parse(Console.ReadLine());
  24.                 while (mostani < minPont || mostani > maxPont)
  25.                 {
  26.                     Console.WriteLine("AZ általad megadott szám nincs az értelmezési tartományon belül!");
  27.                     Console.Write("Kérem a minimum pontszámot: ");
  28.                     mostani = int.Parse(Console.ReadLine());
  29.                 }
  30.                 osszpont += mostani;
  31.             }
  32.             Console.WriteLine("Az átlagpontszám {0} pont lett",(double)osszpont/(double)dogaSzam);
  33.             Console.ReadKey();
  34.  
  35.  
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement