Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. int numeros = 0;
  2. int media = 0;
  3. int n;
  4. while (cin >> n and n != -1) {
  5.    if (n >= 1 and n <= 100) {
  6.      ++numeros;
  7.      media += n;
  8.    }
  9. }
  10.  
  11. cout << "cantidad de numeros entre 1 y 100: " << numeros << endl;
  12. cout << "media: " << media/numeros << endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement