pow() function in C problems [duplicate]
This question already has an answer here: Strange behaviour of the pow function 5 answers I am having some problems with pow() function in C. When ever run this code, 153 as input, the sum evaluates to 152 . However if I dont use pow() function and instead use a for loop to get the value of N n , the sum evaluates to 153 . Can anyone help please explain me this difference? #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> int main(void) { unsigned int i, n, sum = 0, N, a = 1, j; char num[100], x[2] = { 0 }; printf("Determining an armstrong number\n\n" "Enter a number