Advertisement
Guest User

Parzysta

a guest
Apr 5th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3.                               Online C++ Compiler.
  4.                Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <stdio.h>
  10.  
  11.  
  12. bool czyParzysta(int);
  13.  
  14. int main()
  15. {
  16.     int sizeA=10;
  17.     int A[sizeA]={5, 99, 3, 7, 111, 13, 4, 24, 4, 8};
  18.     int result;
  19.    
  20.    
  21.     for(int i=0;i<sizeA;i++){
  22.         if(czyParzysta(A[i])){
  23.             result=A[i];
  24.             break;
  25.         }
  26.     }
  27.  
  28.     printf("Wynik: %d",result);
  29.    
  30.     return 0;
  31. }
  32.  
  33. bool czyParzysta(int n){
  34.     if(n%2==0)
  35.         return true;
  36.     else
  37.         return false;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement