AshfaqFardin

Number Checker (Positive, Negative, Zero)

Jul 29th, 2021
1,657
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void positiveCheck(int *number){
  6.     if(*number > 0){
  7.         cout << "Positive";
  8.     }
  9.     else if (*number < 0){
  10.         cout << "Negative";
  11.     }
  12.     else{
  13.         cout << "Zero";
  14.     }
  15. }
  16.  
  17. int main()
  18. {
  19.     int num = 2;
  20.     positiveCheck(&num);
  21.     cout << endl;
  22.    
  23.     num = 0;
  24.     positiveCheck(&num);
  25.     cout << endl;
  26.    
  27.     num = -2;
  28.     positiveCheck(&num);
  29.     cout << endl;
  30.    
  31.     return 0;
  32. }
  33.  
RAW Paste Data