CHAPTER 07 / 26

C Input & Output

Learn how printf() and scanf() are used for output and keyboard input.

01 — Syntax

printf("text");\nscanf("%d", &variable);

02 — Example

#include <stdio.h>

int main() {
    int age;

    printf("Enter age: ");
    scanf("%d", &age);

    printf("You entered %d", age);
    return 0;
}

03 — Important Points

04 — Common Mistakes

05 — Real-World Use

Input/output concepts are used in command-line tools and educational programs.

06 — Practice

Create a small program that demonstrates the main idea of C Input & Output.

▶ Try It Yourself← PreviousNext →All Chapters