Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- unsigned k;
- cout << "Podaj k: " << endl;
- cin >> k;
- for(int i = 0; i < k; i++) {
- int liczba = 0;
- unsigned liczbaElementow = 0;
- int suma = 0;
- do{
- cout << "Podaj liczbe: " << endl;
- cin >> liczba;
- if(liczba != 0)
- liczbaElementow++;
- suma += liczba;
- } while (liczba != 0);
- cout << "Liczba elementow zestawu " << i+1 << ": " << liczbaElementow << endl;
- cout << "Suma elemntow: " << suma << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement