InnaSibirova

Цикл

Oct 18th, 2019
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main () {
  4.     int t, s, d, e, i = 0, g = 999;
  5.     while (g != 10000) {
  6.         g++;
  7.         t = g / 1000;
  8.         s = g / 100 % 10;
  9.         d = g / 10 % 10;
  10.         e = g % 10;
  11.         if (t + s + d + e == 15) {
  12.             i++;
  13.             cout << g << endl;
  14.         }
  15.     }
  16.     cout << "Quintity = " << i;
  17.     return 0;
  18. }
Add Comment
Please, Sign In to add comment