Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream> v56 3 4a
- using namespace std;
- int n, d;
- int prim(int n,int d)
- {
- while (d<=n/2)
- {
- if (n%d==0)
- return 0;
- else prim(n,d+1);
- return 1;
- }
- }
- int main()
- {
- cin>>n;
- d=2;
- if (prim(n,d)==1)
- cout<<"1";
- else cout<<"0";
- return 0;
- }
- #include <iostream> v 36 3 ceva nuj plm cv cu prim
- int n;
- using namespace std;
- int cifra(int n)
- {
- if ((n%10)%2==0)
- {
- return n%10;
- }
- return cifra(n/10);
- }
- int main()
- {
- cin >> n;
- cout << cifra(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement