Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
- #include <ctype.h>
- int primo(n)
- {
- int i , p;
- for(i = 1; i <= n ; i++)
- {
- if ((n % i) == 0)
- p ++;
- }
- if(p == 2)
- return 1;
- }
- int main()
- {
- int n , r1 , r2;
- int aux1 , aux2 , flag=0;
- do
- {
- scanf("%d" , &n);
- if(n == 0)
- break;
- if(n % 2 != 0)
- printf("erro\n");
- else
- {
- aux1 = n;
- aux2 = 0;
- while(flag == 0)
- {
- aux1--;
- aux2++;
- if(primo(aux1) == 1 && primo(aux2) == 1)
- flag = 1;
- }
- printf("%d %d\n" , aux1 , aux2);
- }
- }while(n != 0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement