Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int n,d,NR,s,S1;
- float ma,S;
- int main(){
- cin>>n;
- for(d=1; d<=n; d++){
- if(n%d==0){
- s=s+d;
- NR++;
- }
- }
- ma=(float) s/NR;
- if(ma==(int)ma) cout<<ma<<".00";
- else if(ma * 10 == int(ma * 10)) cout<<ma<<'0';
- else{
- ma=ma*100;
- S1=(int)ma;
- S=( float) S1/100;
- cout <<S;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement