That's okay. You need to know that because you are using a Microsoft compiler, you're compiling with respect to an older edition of the C standard. In that version of C, variables must be declared at the start of a block, before other code. Thus, this:
Code:
else if (operation=='5')
{
printf("Enter the values:\n");
scanf("%f%f", &val1,&val2);
int i=val1;
int j=val2;
remainder=i%j; //(error 9 and 10)
printf("%f\n\n",remainder);
}
should be:
Code:
else if (operation=='5')
{
int i;
int j;
printf("Enter the values:\n");
scanf("%f%f", &val1, &val2);
i = (int)val1;
j = (int)val2;
remainder = i % j;
printf("%f\n\n", remainder);
}
Though it would be simpler to either read the values as integers to begin with, or use fmod from <math.h> if that makes sense, or cast in the modulo expression:
Code:
else if (operation=='5')
{
printf("Enter the values:\n");
scanf("%f%f", &val1, &val2);
remainder = (int)val1 % (int)val2;
printf("%f\n\n", remainder);
}