![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHKcHZ_rBJtTddaEaL2XjPQCgj1M679Nsr9w3TC8yJ2fUXg29txw3c7TCEdIPBTpBnLRCb_fn5uH79G-RijAX3LbG4RaUd2XARYqRlPQZEZ9hGsmzNM0izxv6BfHTxCUDTd5WZrYrcWcc6/s320/3.3.bmp)
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