I'm starting coding in C and I was doing an exercise, but saw a miscalculation testing this code:
int main(){
int number;
int square;
printf("Pick a number: ");
scanf("%d",&number);
while(number<=0)
{
printf("ERROR: The number MUST be greater than zero\nPick a number greater than zero: ");
scanf("%d",&number);
}
square = pow(number,2);
printf("\nThe square of the number is: %d\n\n",square);
system("pause");
return 0;}
now... everything works just fine, but when I use the number "5", it shows the result "24", when it should be "25". anyone knows why this happen?