Mazamin

01_10_1.4

Oct 2nd, 2019
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1. /*
  2.  * File:   main.c
  3.  * Author: Gerardo Cicalese
  4.  *
  5.  * Created on 16 settembre 2019, 15.48
  6.  */
  7.  
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10.  
  11. #define TRUE 1
  12. #define FALSE 0
  13.  
  14. int check_greater_vex(int * vex, int n, int a){
  15.     if(n==1)
  16.         if(*vex>a)
  17.             return TRUE;
  18.         else
  19.             return FALSE;
  20.     else if(n<1)
  21.         return -1;
  22.     else
  23.         if(*vex>a && TRUE==check_greater_vex(vex+1, n-1, a))
  24.             return TRUE;
  25.         else
  26.             return FALSE;
  27. }
  28.  
  29. int main(void){
  30.     int elem, vex[]={63, 15, 42, 63, 92, 34, 77, 23, 78, 37, 26, 7, 79, 85, 82, 19, 89, 10, 64};
  31.     size_t len=sizeof(vex)/sizeof(vex[0]);
  32.     scanf("%d", &elem);
  33.     printf("Condition is %s\n", (TRUE==check_greater_vex(vex, len, elem))?("verified"):("not verified") );
  34.     return 0;
  35. }
Add Comment
Please, Sign In to add comment