Advertisement
MeehoweCK

Untitled

Mar 28th, 2024
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. int main() {
  6.     srand(time(nullptr));       // time(nullptr) zwraca aktualny czas komputera
  7.     auto liczbaLosowana{ rand() % 30 + 1 };
  8.     std::cout << "Wylosowano liczbe " << liczbaLosowana << ". Jest to liczba ";
  9.     if (liczbaLosowana % 2 == 0) {
  10.         std::cout << "parzysta.\n";
  11.     }
  12.     else {
  13.         std::cout << "nieparzysta.\n";
  14.     }
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement