I need to find The prime factors of 13195 are 5, 7, 13 and 29. / * Largest is 377. * / What is the largest prime factor of the number 600851475143 ?
#include<
600851475143 is too big to fit in 32 bit integer. long
may be 32 bit on your machine. You need to use 64 bit type. The exact data type will be dependent on your platform, compiler.
Your prime checking code is wrong. You are assuming that if something is not devided by 2, 3, 5, 7 then that is prime.