martes, 20 de octubre de 2009

Practica 7.2 consola


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace pract7._2
{
class Program
{
static void Main(string[] args)
{
Double n, i, suma = 0;
Console.WriteLine("\n\n\t\tINTRODUCE UN NUMERO PAR ");
n = double.Parse(Console.ReadLine());
if (n <>
{
Console.WriteLine("\n\n\t\t EL NUMERO ES INCORRECTO ");
}

for (i = 2; i <= n; i = i + 2)
{
suma = suma + i;
}
Console.WriteLine("\n\n\n\t\tLA SUMA DE LOS NUMEROS PARES ES: {0} ", suma);
Console.ReadLine();
}
}
}

No hay comentarios:

Publicar un comentario