Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, d, i, x, nrdcf=0, c, p;
- cout<<"n="; cin>>n;
- for(i=1; i<=n; i++)
- {
- p=0;
- cin>>x;
- if(x==2)
- {
- nrdcf++;
- p=1;
- }
- for(d=2; d<=x/2; d++)
- {
- if(x%d==0)
- p++;
- }
- if(p==0)
- {
- while(x!=0)
- {
- c=x%10;
- nrdcf++;
- x=x/10;
- }
- }
- }
- cout<<nrdcf;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment