### Testing if a number is an integer

I have searched for quite some time now and I cannot figure out how to input a year like 2000 and divide it by 4. Then test to see if it is an integer or a float number.
Do you want to check for leap years? In that case you can use the modulo operator and check if the result is equal to 0
I am fairly new to programming. How exactly would I do that?
The modulo operator in C is %. It gives the remainder in a division between integers (doesn't work with floats at all)
For example 7 % 3 == 1. The quotient is 2 and the remainder is 1

This pseudocode is copypasted from wikipedia
 if year modulo 400 is 0 then is_leap_year else if year modulo 100 is 0 then not_leap_year else if year modulo 4 is 0 then is_leap_year else not_leap_year
You would want x % y = 0, meaning the remainder of x / y is 0 meaning that the final result is a whole number or an integer.
Alright thank you guys. I got the program working. And i learded what a modulo operator is!
Topic archived. No new replies allowed.