I'm writing a C program to print the date of Easter for a given year using the Gaussian algorithm. I'm really new to C. Here's the code:
#include <math.h>
int main () {
int year = 1998;
int a = year % 19;
int b = year % 4;
int c = year % 7;
int k = floor (year/100);
int p = floor ((13 + 8k)/25);
int q = floor (k/4);
int M = (15 − p + k − q) % 30;
int N = (4 + k − q) % 7;
int d = (19a + M) % 30;
int e = (2b + 4c + 6d + N) % 7;
if (d == 29 && e == 6) {
printf("19 April");
}
else if (d == 28 && e = 6 && (11M + 11) % 30 < 19) {
printf("18 April");
}
else if (22 + d + e < 32) {
printf("%d March", (22 + d + e));
}
else {
printf("%d April", d + e - 9);
}
return 0;
}
And the errors according to CodePad:
Line 23: error: invalid suffix "k" on integer constant
In function 'main':
Line 10: error: stray '\342' in program
Line 10: error: stray '\210' in program
Line 10: error: stray '\222' in program
Line 10: error: expected ')' before 'p'
Line 10: error: stray '\342' in program
Line 10: error: stray '\210' in program
Line 10: error: stray '\222' in program
Line 11: error: stray '\342' in program
Line 11: error: stray '\210' in program
Line 11: error: stray '\222' in program
Line 11: error: expected ')' before 'q'
Line 11: error: invalid suffix "a" on integer constant
Line 11: error: invalid suffix "b" on integer constant
Line 16: error: invalid suffix "c" on integer constant
Line 21: error: invalid suffix "d" on integer constant
Line 32: error: invalid suffix "M" on integer constant
As far as I can tell, there isn't any no "k" in line 23, so why is the compiler complaining?