Question PRG-C-0002
EasyWhat is the output of this program?
#include <stdio.h>
int main(void) {
printf("%d", 7 / 2);
return 0;
}
- A.
4
- B.
3.5
- C.
Show answer and explanation
Answer: D
Both operands are int, so 7 / 2 is integer division: 3.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
C question
What is the output of this program?
#include <stdio.h>
int main(void) {
printf("%d", 7 / 2);
return 0;
}
4
3.5
Answer: D
Both operands are int, so 7 / 2 is integer division: 3.
3.500000
3