first commit
This commit is contained in:
36
listas3/source/exercicio1.cs
Normal file
36
listas3/source/exercicio1.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user