Why isn't working the powering of number on the real time calculater ?
#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[])
{
int num1, num2;
int sum, sub, mult, mod,pow;
float div;
/*
* Read two numbers from user separated by comma
*/
printf("Input any two numbers separated by comma : ");
scanf("%d,%d", &num1, &num2);
/*
* Performs all arithmetic operations
*/
sum = num1 + num2;
sub = num1 - num2;
mult = num1 * num2;
div = (float)num1 / num2;
mod = num1 % num2;
pow = num1 ^ num2;
/*
* Prints the result of all arithmetic operations
*/
printf("The sum of the given numbers : %d\n", sum);
printf("The difference of the given numbers : %d\n", sub);
printf("The product of the given numbers : %d\n", mult);
printf("The quotient of the given numbers : %f\n", div);
printf("MODULUS = %d\n", mod);
printf("%f The powering of the given numbers : %f is %f\n", pow);
four problems.
1) you have already been warned about making more threads on the same topic. keep it in one post.
2) you have already been told to use pow or write your own.
3) ^ is logical xor.
4) pow() is the function and using it as a variable name may cause you problems. Also, as I already said, pow is not real time for integers, re-read that.