Created
September 3, 2014 17:14
-
-
Save shohan4556/651b4aeb4ea3ffb1dafd to your computer and use it in GitHub Desktop.
find out the largest prime number bangla
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
long long number; | |
printf("Enter a number to know its largest prime factor: "); | |
scanf("%lld",&number); | |
long long div=2, maxFact; | |
while(number!=0){ | |
if(number % div !=0) | |
div = div + 1; | |
else{ | |
maxFact = number; | |
number = number / div; | |
if(number == 1){ | |
printf("%d is the largest prime factor !",maxFact); | |
// ans = 1; | |
break; | |
} // end 2nd if | |
} // end else | |
} // end loop | |
return 0; | |
} // end main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment