#include <stdio.h>
#include <string.h>

int main() {
    char bookName[100];
    float bookPrice, discount, totalPrice;

    // รับข้อมูลชื่อหนังสือ
    printf("Enter book name: ");
    fgets(bookName, sizeof(bookName), stdin); // ใช้ fgets แทน gets เพื่อความปลอดภัย
    bookName[strcspn(bookName, "\n")] = '\0'; // ลบ newline ที่ fgets เพิ่มเข้ามา

    // รับข้อมูลราคาหนังสือ
    printf("Enter book price: ");
    scanf("%f", &bookPrice);

    // คำนวณส่วนลดและราคาสุทธิ
    discount = bookPrice * 0.10;
    totalPrice = bookPrice - discount;

    // แสดงผลลัพธ์
    printf("\nBook: %s\n", bookName);
    printf("Price: %.2f\n", bookPrice);
    printf("Discount 10 percent: %.2f\n", discount);
    printf("Total price: %.2f\n", totalPrice);

    return 0;
}