ToniDev

While Loop

Dec 3rd, 2021
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int a, n, i = 0;
  7.  
  8.     cout << "Introdu n: ";
  9.     cin >> n;
  10.  
  11.     while(i < n)
  12.     {
  13.         cout << "Introdu a: ";
  14.             cin >> a;
  15.  
  16.             if (a % 2 == 0)
  17.             {
  18.                 cout << "OK" << endl;
  19.             }
  20.             else
  21.             {
  22.                 cout << "nu e par." << endl;
  23.             }
  24.  
  25.             i++;
  26.     }
  27.    
  28.     return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment