StoneHaos

sergo

Feb 4th, 2020
144
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(void) {
  6.     int n;
  7.     cin >> n;
  8.     int cnt = 0, s = 0;
  9.     for (; n != 0; cnt ++) {
  10.         s += n % 10;
  11.         n /= 10;
  12.     }
  13.     cout << (s / (double)cnt) << endl;
  14.     return 0;
  15. }
RAW Paste Data