Skip to content

Instantly share code, notes, and snippets.

@MayogaX
Created September 21, 2015 20:54
Show Gist options
  • Save MayogaX/a77429fba385f1eb412b to your computer and use it in GitHub Desktop.
Save MayogaX/a77429fba385f1eb412b to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExemploMedia
{
class Program
{
static void Main(string[] args)
{
int totalAlunos;
decimal notas = 0;
decimal media;
Console.WriteLine("Digite a quantidade de alunos da sala:");
totalAlunos = Convert.ToInt32(Console.ReadLine());
for (int x = 1; x <= totalAlunos; x++)
{
Console.WriteLine("Digite a nota do aluno " + x.ToString());
notas = notas + Convert.ToDecimal(Console.ReadLine());
}
media = notas / totalAlunos;
Console.WriteLine("A média entre os alunos é " + media.ToString());
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment