how can i check if the number is positive or not by using switch statement
please who know the answer help me and answer the question
meme meme 0 Newbie Poster
Tygawr commented: Someone gave you -1 because he just lost his job as a computer consultant, so I gave you +1. +0
Recommended Answers
Jump to Posthow can i check if the number is positive or not by using switch statement
Use the % operator in the SWITCH statement. You know what values you will get so use those values in the CASE statements.
please who know the answer help me and answer the question
Please …
Jump to PostYes I can.
If you want me to do it for you, as a computer consultant I get $85 an hour.
Jump to PostI would use abs() (from math.h) inside the switch statement (assuming you're dealing only with integers).
All 10 Replies
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
meme meme 0 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Tygawr commented: not worth it. +0
pheininger 5 Light Poster
thines01 401 Postaholic Team Colleague Featured Poster
shadyreal 0 Newbie Poster
thines01 401 Postaholic Team Colleague Featured Poster
Tygawr -12 Newbie Poster
Tygawr -12 Newbie Poster
WaltP commented: And yet again you do someone's homework for them. You just don't get it, do you... -4
Tygawr -12 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.