Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created September 3, 2014 17:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shohan4556/651b4aeb4ea3ffb1dafd to your computer and use it in GitHub Desktop.
Save shohan4556/651b4aeb4ea3ffb1dafd to your computer and use it in GitHub Desktop.
find out the largest prime number bangla
#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