Discounted PAT 2018 Team Programming Ladder Competition

When shopping for discounted items in the mall, calculating the price after the discount is a very tedious thing. For example, the original price is ¥988, and it is marked as 30% off, then the discount price should be ¥988 x 70% = ¥691.60. In this question, please write a program to calculate the discount price for the customer.

Input format:

The input gives the original price of the product (a positive integer not exceeding 10,000 yuan) and the discount (integer in the range [1, 9]) in one line, separated by spaces.

Output format:

Prints the discounted price of the item in one line with 2 decimal places.

Input sample:
988 7
Sample output:
691.60
#include<stdio.h>
int main() {
	int money, d;
	scanf("%d %d", &money, &d);
	printf("%.2f\n", (double)money*d/10);
	return 0;
}


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326040578&siteId=291194637