Hi,
Please take a look at this. It's only basic, since I'm doing my foundations course in C at university.
When I run the compiled programme, I get the following output:
So I never get to input whether or not I want to continue (y/n). It just skips straight onto the while and loops round. Any ideas? Maybe it's just a tiny error, but I'll be damned if I can see it. Thanks!Code:[ec09411@dil027 8_3]$ ./Lab8_3 Enter an integer (): 4 Even Continue (y/n): Enter an integer (): ^C [ec09411@dil027 8_3]$
Code:#include <stdio.h> int even(int input); int main(void) { char contin; int input; do { contin = 0; printf("Enter an integer: "); scanf("%d", &input); if (even(input)) { printf("Even\n"); } else { printf("Odd\n"); } printf("Continue (y/n): "); scanf("%c", &contin); } while (contin != 'n'); return 0; } int even(int input) { return !(input%2); } /*End of programme*/