Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- #include<stdbool.h>
- bool Perplexing_Primes(int n)
- {
- if(n<=1)
- return false;
- if(n==2)
- return true;
- if(n>2 && n%2==0)
- return false;
- int div = sqrt(n);
- for(int i=3;i<=div;i+=2)
- if(n%i==0)
- return false;
- return true;
- }
- void Multiplicated_Value(int n)
- {
- while(n%2 == 0){
- printf("2 ");
- n/=2;
- }
- for(int i= 3; i<=sqrt(n);i+=2){
- while(n%i==0){
- printf("%d ",i);
- n/=i;
- }
- }
- if(n>2)
- printf("%d ",n);
- printf("\n");
- }
- int main()
- {
- int n = (55 % 5) + 31;
- bool arr[n+1];
- if(Perplexing_Primes(n)){
- printf("%d is a prime!\n",n);
- }
- else{
- Multiplicated_Value(n);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement