3 ответов
0
You can check numbers divisibility using modulo operator %. When A % B == 0, then A is divisible by B. Even means being divisible by 2 and odd means not being divisible by 2, so C is even when C % 2 == 0, and odd when C % 2 != 0. a float (other than ±inf) is always a fraction number.
15th Oct 2020, 7:58 PM
Seb TheS
Seb TheS - avatar
0
Ok
16th Oct 2020, 3:05 AM
Kunal Kamble
Kunal Kamble - avatar
0
I'll explain how but you really need to try it yourself. You can check a number if it's even or odd just by operate the number with modulo 2 (n%2 ? "Odd" : "Even"). You can check if the number is fractional by using an int types (int, long, ll), take the number and assign in to a float variable and then assign it again to the int variable, compare it (i==f ? "Integer" : "Fractional"). You can check if your input is a letter by using isalpha() (included in ctype).
17th Oct 2020, 2:28 AM
LastSecond959
LastSecond959 - avatar