Advertisement
clari-g

apunte2-ej1

May 8th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.   float precio;
  7.   float descuento; /*del 10%*/
  8.   float preciofinal;
  9.   char nombre[20];
  10.  
  11.   printf("nombre: ");
  12.   scanf("%[^\n]s", &nombre);
  13.   printf("Ingrese el importe del producto: ");
  14.   scanf("%f", &precio);
  15.  
  16.   descuento=(precio*10)/100;  
  17.   preciofinal=precio-descuento;
  18.  
  19.   printf("\n Nombre del cliente: %s\n Precio del producto: $%.2f\n Descuento: $%.2f\n Precio final: $%.2f\n", nombre,precio,descuento,preciofinal);
  20.  
  21.   system("pause");
  22.   return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement