using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Program
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Program liczy średnią ocene");
int n,ile2=0, ile5=0;
double oc, sr;
Console.WriteLine("Wpisz ile ocen:");
while (!int.TryParse(Console.ReadLine(), out n) && n < 1)
Console.WriteLine("Błędna wartość podaj jeszcze raz:");
double s = 0;
Console.WriteLine("Podaj ilość ocen ucznia?");
for (int i = 1; i <= n; i++)
{
Console.Write("{0}:Ocena", i);
while (!double.TryParse(Console.ReadLine(), out oc) ||
//oc < 2 || oc > 5)
// /* jest źle*/ (oc !=2 && oc !=3 && oc !=3.5 && oc !=4 && oc !=4.5 && oc !=5)
/*jest dobrze*/ !(oc == 2 || oc == 3 || oc == 3.5 || oc == 4 || oc == 4.5 || oc ==5)
)
Console.WriteLine("Błędna wartość, podaj jeszcze raz: ");
s = s + oc;
if (oc == 2) ile2++;
if (oc == 5) ile5++;
}
sr = s / n;
Console.WriteLine("Średnia ocen to: {0}", sr);
Console.WriteLine(" Ilość dwójek to {0}, ilość piątek to {1}", ile2, ile5);
Console.ReadKey();
Console.WriteLine("Wciśnij dowolny klawisz");
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}