37 lines
691 B
C#
37 lines
691 B
C#
using System;
|
|
|
|
namespace exercicios
|
|
{
|
|
class Exercicio1{
|
|
public static void Init()
|
|
{
|
|
string nome;
|
|
|
|
Console.WriteLine("Write a Name");
|
|
nome = Console.ReadLine();
|
|
|
|
double media = lerNota();
|
|
|
|
Console.WriteLine("Student: {0}, Avg. Grade: {1:N2}",nome,media);
|
|
Console.WriteLine(media > 7 ? "PASS" : "FAIL");
|
|
}
|
|
static double lerNota()
|
|
{
|
|
|
|
float n1,n2;
|
|
|
|
Console.WriteLine("Insert the grades (2)...");
|
|
n1 = float.Parse(Console.ReadLine());
|
|
n2 = float.Parse(Console.ReadLine());
|
|
|
|
return calcularMedia(n1,n2);
|
|
|
|
}
|
|
|
|
static float calcularMedia(float i, float i2)
|
|
{
|
|
return ((i+i2)/2);
|
|
}
|
|
}
|
|
}
|