ExamVeda
Login
Home
This question belongs to C Program C Fundamentals
C Fundamentals
?

What number would be shown on the screen after the following statements of C are executed?
char ch; 
int i; 
ch = 'G'; 
i = ch-'A';
printf("%d", i);

Answer & Solution
Correct Answer: Option B

Since the ASCII value of G is 71 and the garbage value if A is 65 and hence the difference is 6.

Examveda
Question posted by Examveda
Community

Join the Discussion

4 Comments
Shweta Jori
Shweta Jori 7 years ago
2nd solution
In hexadecimal value of A is 10 & G is 16
So answer will be 6
Shyama Sundar
Shyama Sundar 10 years ago
option B
Shyama Sundar
Shyama Sundar 10 years ago
option B
Shyama Sundar
Shyama Sundar 10 years ago
option B