Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void getInt(int *number);
  4. void compareInt(int num1, int num2, int *larger);
  5. void displayInt(int result);
  6.  
  7. int main(int argc, char const *argv[])
  8. {
  9.    int input1, input2;
  10.    int result;
  11.    getInt(&input1);
  12.    getInt(&input2);
  13.    compareInt(input1, input2, &result);
  14.    displayInt(result);
  15.    return 0;
  16. }
  17.  
  18. void getInt(int *number)
  19. {
  20.    scanf("%d", number);
  21. }
  22.  
  23. void compareInt(int num1, int num2, int *larger)
  24. {
  25.    if(num1 > num2)
  26.    {
  27.       *larger = num1;
  28.    }
  29.    else
  30.    {
  31.       *larger = num2;
  32.    }
  33.    
  34. }
  35.  
  36. void displayInt(int result)
  37. {
  38.    printf("%d is the larger integer", result);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement