- 2

#include<stdio.h> int main() { char x,y; int i; x='F': i=x-'A'; y=x-'F'+65; printf("%d %c", i,y); return 0; }

22nd Apr 2021, 7:36 AM
It's Me
It's Me - avatar
3 Answers
+ 2
Not sure if this is your question, but when assigning F to 'x', you used a colon to terminate the line instead of a semicolon, which prevents your code from compiling correctly. Otherwise, you should give more information on why you opened this thread.
22nd Apr 2021, 7:45 AM
Shadow
Shadow - avatar
+ 2
Just execute the statement in a compiler and see what the output is. In this case, it is important to keep in mind that integers don't store fractions, so when converting from a floating point number to an integer, anything after the decimal point is simply truncated.
22nd Apr 2021, 7:54 AM
Shadow
Shadow - avatar
- 2
Choose a right statement. int x = 100 + 1.666666; A.x = 101.6666666 B.Compiler error C.x = 101.666667 D.X = 101
22nd Apr 2021, 7:49 AM
It's Me
It's Me - avatar