Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

Vibhor16

  • 4 years ago

How to check if input number is -ve or +ve in C/C++?

  • This Question is Closed
  1. Parsa
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 3

    main() { int x; if x>0 cout<<"Positive"; else if x<0 cout<<"Negative"; else cout<<"Zero"; getch(); } I think it should work.

  2. Parsa
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 3

    Sorry, after int x, you should get the input: cin>>x;

  3. Vibhor16
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    :P that was easy.Sorry to bother you for that.

  4. Parsa
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 3

    No problem! :)

  5. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy