Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Autor: Pawel Koniarski
- // Data: 2 października 2013 r.
- // Problem: Sumuj liczby podzielne przez 7 sposrod liczby liczb podanych przez uzytkownika.
- // Specyfikacja: w zeszycie
- // Plik: zad5-37.cpp
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, suma, d;
- suma = 0;
- cout << "Podaj liczbe liczb, ktore chcesz poddac operacji dodania w przypadku podzielnosci przez 7: ";
- cin >> n;
- cout << "\nPodaj " << n << " liczb.\n";
- while (n > 0)
- {
- cin >> d;
- if (d % 7 == 0)
- suma += d;
- n--;
- }
- cout << "Wynik: " << suma << "\n\n";
- cin.sync();
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement