SHARE
TWEET

Untitled

a guest Dec 8th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int n,d,NR,s,S1;
  5. float ma,S;
  6. int main(){
  7.      cin>>n;
  8.      for(d=1; d<=n; d++){  
  9.           if(n%d==0){       
  10.                s=s+d;      
  11.                NR++;   
  12.           }
  13.       }
  14.       ma=(float) s/NR;
  15.       if(ma==(int)ma)    cout<<ma<<".00";
  16.       else if(ma * 10 == int(ma * 10))    cout<<ma<<'0';
  17.       else{   
  18.           ma=ma*100;   
  19.           S1=(int)ma;   
  20.           S=( float) S1/100;   
  21.           cout <<S;
  22.       }
  23.       return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top