Se
compra N artículos a un precio unitario X. Escribir un algoritmo que permita
calcular el impuesto a pagar (18%sobre el precio de venta) asi como el importe
total por la venta de los N artículos.
CONSOLA
static
void Main(string[]
args)
{
//declarar
varibles
int
cantidad;
double
preciounitario;
double
IGV;
double
preciototal;
double
precioventa;
//datos
Console.WriteLine("ingrese cantidad");
cantidad = int.Parse(Console.ReadLine());
Console.WriteLine("ingrese precio unitario");
preciounitario = Double.Parse(Console.ReadLine());
//procesos
precioventa = cantidad * preciounitario;
IGV = precioventa * 18 / 100;
preciototal = precioventa + IGV;
//resultados
Console.WriteLine("el IGV es:");
Console.WriteLine(IGV);
Console.WriteLine("el precio Total es :");
Console.WriteLine(preciototal);
Console.ReadKey();
}
Codificacion en Windows form
private
void btnprocesar_Click(object
sender, EventArgs e)
{
//declarar
variables
int
cantidad;
double
precio;
double
importe;
double
igv;
double
importetotal;
//datos
cantidad = int.Parse(txtcantidad.Text);
precio = double.Parse(txtprecio.Text);
//procesos
importe = precio * cantidad;
igv = importe * 18 / 100;
importetotal = importe + igv;
//resultados
txtigv.Text
= igv.ToString();
txtimportetotal.Text =
importetotal.ToString();
}
private
void btnnuevo_Click(object
sender, EventArgs e)
{
//limpieza
txtcantidad.Text = "";
txtprecio.Text = "";
txtigv.Text = "";
txtimportetotal.Text = "";
No hay comentarios:
Publicar un comentario