Here is my code and it will compile and run perfectly in Borland, but using gcc in Unix, I get an error, "invalid operand to binary" or something along those lines and I have no idea what to do to correct it. Here is my code:
Code:
#include <stdio.h>
int main()
{
int num1;
int num2;
int den1;
int den2;
int finalnum;
int finalden;
printf("Please enter in the numerator of the first fraction: ");
scanf("%d", &num1);
printf("Please enter in the denominator of the first fraction: ");
scanf("%d", &den1);
printf("Please enter in the numerator of the second fraction: ");
scanf("%d", &num2);
printf("Please enter in the denominator of the second fraction: ");
scanf("%d", &den2);
finalnum = (num1*den2)+(num2*den1);
finalden = den1*den2;
printf("The answer is %d/%d", finalnum, finalden);
fflush(stdin);
getchar();
return 0;
}
[code tags added by ygfperson]