Code:
#include <stdio.h>
#include <math.h>
void exercise (void);
int century (int y)
{
int centur = y / 100;
y &= 100;
if (y > 0)
y = centur + 1;
else
y = centur;
return y;
}
void exercise (void)
{
int y;
while (scanf ("%d", &y) != EOF)
{
int z = century (y);
printf ("%d\n", z);
}
}
int main (void)
{
exercise ();
return 0;
}
Input:
1900
out:
19 (i need 18)
Input:
1901
Out:
19
i also tested with
Code:
if (y > 0)
y = centur - 1;
and nope... wrong
note:
i cannot change the "void exercise (void)" and main funtion