0

Why the answer is "Solo"?

#include <iostream> using namespace std; int main() { int i = 65; char j = 'A'; if(i == j) { cout << "Solo"; } else { cout << "Learn"; } }

26th Mar 2019, 9:37 AM
Daniel Figueiredo
Daniel Figueiredo - avatar
3 Answers
+ 14
When you try to compare any int and char, then char is converted to its ASCII Code. The ASCII Code of A is 65, so the first condition becomes true and there you go.
26th Mar 2019, 9:41 AM
Letsintegreat
Letsintegreat - avatar
+ 7
ASCII value of A=65 that means I==j true that's why answer is solo
26th Mar 2019, 9:40 AM
Scooby
Scooby - avatar
+ 1
Thank you
26th Mar 2019, 10:05 AM
Daniel Figueiredo
Daniel Figueiredo - avatar