Advertisement
LarvitarYoung

FormNumber by Prime

Nov 6th, 2021
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. #include<stdbool.h>
  4. bool prmie(int number){
  5.     if(number<2){return false;}
  6.     for(int i=2;i<=sqrt(number);i++){
  7.         if(number%i==0){
  8.             return false;
  9.         }
  10.     }
  11.     return true;
  12. }
  13. void main(int argc, char const *argv[]){
  14.     int input;
  15.     scanf("%d",&input);
  16.     for (int i = 2; i < input/2; i++){
  17.         if(prmie(i)&prmie(input-i)){printf("%d=%d+%d\n",input,i,input-i);}
  18.     }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement