Advertisement
StoneHaos

sergo

Feb 4th, 2020
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement