Code: Select all
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int one;
int two;
int times;
int sum;
int diff;
float quotient;
char inString[81];
printf("Input a value \n");
gets(inString);
one = atoi(inString);
printf("Input a second value \n");
gets(inString);
two = atoi(inString);
times = one*two;
sum = one+two;
diff = one-two;
quotient = one/two;
printf("Multiplied = %i \n Added = %i \n Subtracted = %i \n Divided = %f \n", times, sum, diff, quotient);
system("PAUSE");
return 0;
}
Ok, now everything works great, except for the quotient value, I'm using a float, as the result may be a fraction. However I don't get what I expect, it gives me a zero when I print the value.
I just can't figure out were I'm missing something.