Here is the source I wrote.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main()
{
int x;
int y;
int total;
int i;
i=0;
total=1;
printf("Enter a base limit for x : \n");
scanf("%d",&x);
printf("Enter an exponent limit for y: \n");
scanf("%d",&y);
while( i < y)
{
total = total * x ;
i++;
}
printf("The total of %d raised to %d = %d", x,y,total);
getch();
getch();
return 0;
}
this calculator works for a majority of the math except :
100 ^ 100 = 0 in some cases
in another case the calculator is just plain wrong. EX:
19^9 = 322687697779
my calculator says:
19^9 = 565 150 579
Any advice on why this is happening so i can figure out how to fix it would be much appreciated.
Thank you for your time.