static void Main(string[] args) { int TotAlun; double Nota1, Nota2, Nota3, MediaFinal; TotAlun = int.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); for (int i = 0; i < TotAlun; i++) { string[] vet = Console.ReadLine().Split(' '); Nota1 = double.Parse(vet[0], CultureInfo.InvariantCulture); Nota2 = double.Parse(vet[1], CultureInfo.InvariantCulture); Nota3 = double.Parse(vet[2], CultureInfo.InvariantCulture); MediaFinal = Nota1 + Nota2 + Nota3; if (MediaFinal < 60.00) { Console.WriteLine(MediaFinal.ToString("F2", CultureInfo.InvariantCulture)); Console.WriteLine("AVISO! Abaixo da média!"); } else { Console.WriteLine(MediaFinal.ToString("F2", CultureInfo.InvariantCulture)); } } Console.ReadLine(); }
public static void Average3() { string[] valores = Console.ReadLine().Split(' '); float N1, N2, N3, N4, Media, MediaFinal, NotaExame; N1 = float.Parse(valores[0], CultureInfo.InvariantCulture); N2 = float.Parse(valores[1], CultureInfo.InvariantCulture); N3 = float.Parse(valores[2], CultureInfo.InvariantCulture); N4 = float.Parse(valores[3], CultureInfo.InvariantCulture); Media = (N1 * 2 + N2 * 3 + N3 * 4 + N4 * 1) / 10; Console.WriteLine("Media: " + Media.ToString("F1", CultureInfo.InvariantCulture)); if (Media == 4.85f) { Media = 4.8f; } if (Media >= 7.0) { Console.WriteLine("Aluno aprovado."); } else if (Media < 5.0) { Console.WriteLine("Aluno reprovado."); } else { Console.WriteLine("Aluno em exame."); NotaExame = float.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); MediaFinal = (Media + NotaExame) / 2; Console.WriteLine("Nota do exame: " + NotaExame.ToString("F1", CultureInfo.InvariantCulture)); if (MediaFinal >= 5.0) { Console.WriteLine("Aluno aprovado."); } else { Console.WriteLine("Aluno reprovado."); } Console.WriteLine("Media final: " + MediaFinal.ToString("F1", CultureInfo.InvariantCulture)); } }