For the input of: 4.1, the output is supposed to be: 6. Please help, it seems that the output of the program that i wrote is just random.
Edit:
Code:
#include <stdio.h>
int main(void) {
while (1) {
printf("Please enter a number:\n");
double number0;
scanf("%lf",&number0);
int number,check1,check2,result1,result2;
number = (int)number0;
result1 = number++;
result2 = number+2;
check1 = result1%2;
check2 = result2%2;
if (check1==0)
printf("The nearest even integer that's greater than the entered number = %i. \n",result1);
else
printf ("The nearest even integer that's greater than the entered number = %i. \n", result2);
}
return 0; }