Problem: URI snack 1038:
Solve:
/* URI snack 1038*/
#include<stdio.h> void main() { int product_code,quantity; float total; scanf("%d %d",&product_code,&quantity); total = product_code*quantity; if(product_code == 1 ) { total = 4.00 * quantity; printf("Total: R$ %0.2f\n",total); } else if (product_code == 2 ){ total = 4.50 * quantity; printf("Total: R$ %0.2f\n",total); } else if (product_code == 3 ){ total = 5.00 * quantity; printf("Total: R$ %0.2f\n",total); } else if (product_code == 4 ){ total = 2.00 * quantity; printf("Total: R$ %0.2f\n",total); } else if (product_code == 5 ){ total = 1.50 * quantity; printf("Total: R$ %0.2f\n",total); } }
No comments:
Post a Comment