Printing Numbers

Lab C Beginner 10 points

Print 7 + 5 = 12 where both numbers and the result come from %d placeholders (compute 7 + 5 in the code).

Input

None.

Output

7 + 5 = 12

Example

Output

7 + 5 = 12
Sample output available
Editor
C

Hints

%d is replaced by an int argument.

Arguments fill placeholders left to right.

Solution explanation

The format string has one placeholder per extra argument, in the same order.

Show solution
#include <stdio.h>

int main() {
    int a = 7;
    int b = 5;
    printf("%d + %d = %d\n", a, b, a + b);
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD