C - Input and OutputWhich of the following correctly reads two integers and prints their sum in C?Aint a, b; scanf("%d %d", &a, &b); printf("%d", a + b);Bint a, b; scanf("%d", a, b); printf("%d", a + b);Cint a, b; scanf("%d %d", a, b); printf("%d", a + b);Dint a, b; scanf("%d %d", &a, &b); printf("%d %d", a, b);Check Answer
Step-by-Step SolutionSolution:Step 1: Understand scanf usage for multiple inputsscanf requires addresses of variables using & to store input values correctly.Step 2: Check printf for correct outputPrinting the sum requires one %d and the expression a + b.Final Answer:Correctly reads two integers and prints their sum. -> Option AQuick Check:Correct scanf and printf usage = int a, b; scanf("%d %d", &a, &b); printf("%d", a + b); [OK]Quick Trick: Use & with variables in scanf for input [OK]Common Mistakes:Forgetting & in scanfUsing wrong format specifiersPrinting variables without format specifiers
Master "Input and Output" in C9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More C Quizzes Conditional Statements - Else–if ladder - Quiz 12easy Loop Control Statements - Goto statement overview - Quiz 11easy Loops - For loop - Quiz 8hard Loops - Do–while loop - Quiz 10hard Loops - For loop - Quiz 9hard Loops - For loop - Quiz 2easy Operators and Expressions - Why operators are needed - Quiz 5medium Operators and Expressions - Increment and decrement operators - Quiz 2easy Variables and Data Types - Basic data types - Quiz 14medium Variables and Data Types - Scope of variables - Quiz 8hard