Book Database

Easy Structures & Unions
Solve in Playground →

Problem Statement

Write a C program using a structure to store book title, author, and price, then print them.

Input Format

A string title, a string author, and a float price.

Output Format

Print book details in the format 'Title: X, Author: Y, Price: Z' (price to 2 decimal places).

Constraints

Title and Author lengths <= 50, 0.0 <= Price <= 10000.0

Sample Input

C_Programming Dennis 450.75

Sample Output

Title: C_Programming, Author: Dennis, Price: 450.75

Explanation

Defines a Book structure and displays fields correctly.

Starter Code

#include <stdio.h>

struct Book {
    char title[51];
    char author[51];
    float price;
};

int main() {
    struct Book b;
    if (scanf("%50s %50s %f", b.title, b.author, &b.price) == 3) {
        // Write your code here
    }
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used