Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int f(int x)
- {
- int i, sum=0;
- for(i=1; i<=x; i++)
- if(x%i==0)
- sum=sum+i;
- return sum;
- }
- int main()
- {
- int x, n, i, ct=0, a[100];
- cin>>x;
- cout<<"Suma este: "<<f(x)<<endl;
- cin>>n;
- for(i=0; i<n; i++)
- cin>>a[i];
- for(i=0; i<n; i++)
- {
- if(f(a[i])==a[i]+1)
- ct++;
- }
- cout<<ct;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement