20090925

PRACTICA 3.3DESCUENTOS (consola)


DESCUENTOS: ESTRUCTURA DE PROGRAMA PARA DESCUENTOS FORMA CONSOLA.

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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int cod, cant, precio, total, descuento, pago;
Console.WriteLine("\t introduce codigo");
cod = int.Parse(Console.ReadLine());
Console.WriteLine("\t introduce la cantidad");
cant = int.Parse(Console.ReadLine());
Console.WriteLine("\t introduce el precio");
precio = int.Parse(Console.ReadLine());
if (cant > 100)
{
Console.WriteLine("\t descuento 40%");
total = cant * precio;
descuento = (total * 40) / 100;
pago = total - descuento;
}

else
{
if (cant > 24)
{
Console.WriteLine("\tdescuento 20%");
total = cant * precio;
descuento = (total * 20) / 100;
pago = total - descuento;
}
else
{
if (cant > 9)
{
Console.WriteLine("descuento 10%");
total = cant * precio;
descuento = (total * 10) / 100;
pago = total - descuento;
}
else
{
Console.WriteLine("no hay descuento");
total = cant * precio;
descuento = 0;
pago = total - descuento;
}
}
}

Console.WriteLine("el total es:{0}", total);
Console.WriteLine("el precio final es {0}",pago);
Console.ReadKey();
}
}
}

No hay comentarios:

Publicar un comentario