C scanf Example

This C example demonstrates printf prompts, scanf input, and simple numeric output. It is designed for small learning programs in the browser-side C runtime.

C Compiler

Code Example

#include <stdio.h>

int main() {
    int first;
    int second;

    printf("Enter two numbers: ");
    scanf("%d %d", &first, &second);

    printf("Sum = %d\n", first + second);
    return 0;
}

Expected Output

Enter two numbers: 10 15
Sum = 25

Practice Steps

  1. Open the C compiler and paste the code.
  2. Run it, then enter two integers in the terminal.
  3. Change the formula to practice subtraction, multiplication, or division.
HOME LEARN COMMUNITY DASHBOARD