csansoon

X54177 Suma de secuencias de enteros

Feb 15th, 2019
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int n,x;
  6.     cin >> n >> x;
  7.     for (int i=1; i<=n; ++i) {
  8.         int o, total=0;
  9.         while (cin >> o and o!=x) total+=o;
  10.         string s;
  11.         getline(cin,s);
  12.         cout << "La suma de la secuencia " << i << " es " << total << endl;
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment