Advertisement
AshfaqFardin

Number Checker (Positive, Negative, Zero)

Jul 29th, 2021
1,986
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  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.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement