using System;
using System.Collections.Generic;
using System.Text;
namespace ej5-5
{
class Program
{
static void Main(string[] args)
{
float media, num, suma, numval;
media = 0;
numval = 0;
num = 0;
suma = 0;
Console.WriteLine("Escriba los numeros");
num = float.Parse(Console.ReadLine());
while (num > 0)
{
numval++;
suma = suma + num;
Console.WriteLine("Escriba un numero");
num = float.Parse(Console.ReadLine());
}
if (num < 0)
media = suma / numval;
Console.WriteLine("El promedio es {0}", media);
}
}
}
using System.Collections.Generic;
using System.Text;
namespace ej5-5
{
class Program
{
static void Main(string[] args)
{
float media, num, suma, numval;
media = 0;
numval = 0;
num = 0;
suma = 0;
Console.WriteLine("Escriba los numeros");
num = float.Parse(Console.ReadLine());
while (num > 0)
{
numval++;
suma = suma + num;
Console.WriteLine("Escriba un numero");
num = float.Parse(Console.ReadLine());
}
if (num < 0)
media = suma / numval;
Console.WriteLine("El promedio es {0}", media);
}
}
}
0 Comments:
Post a Comment
<< Home