Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <iostream> v56 3 4a
  2. using namespace std;
  3. int n, d;
  4. int prim(int n,int d)
  5. {
  6. while (d<=n/2)
  7. {
  8. if (n%d==0)
  9. return 0;
  10. else prim(n,d+1);
  11. return 1;
  12. }
  13.  
  14. }
  15. int main()
  16. {
  17. cin>>n;
  18. d=2;
  19. if (prim(n,d)==1)
  20. cout<<"1";
  21. else cout<<"0";
  22. return 0;
  23. }
  24.  
  25.  
  26. #include <iostream> v 36 3 ceva nuj plm cv cu prim
  27. int n;
  28. using namespace std;
  29. int cifra(int n)
  30. {
  31. if ((n%10)%2==0)
  32. {
  33. return n%10;
  34. }
  35. return cifra(n/10);
  36. }
  37. int main()
  38. {
  39. cin >> n;
  40. cout << cifra(n);
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement