id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > quiz2021_10_12_APSLHL_sigNum
prev  |  next  |  chance

Write a method called "sigNum" that returns information about the SIGN of the input parameter 'num'. There are three possible signs for numbers. Integers can be positive, negative, or unsigned. Zero is the only unsigned integer. To indicate a positive sign, return 1. To indicate a negative sign, return -1. To indicate unsigned, return 0. Look at the test date for examples. You may NOT use the "Math" library or any methods from that library. Of course you MAY use any normal math operations.


quiz2021_10_12_APSLHL_sigNum(235) → 1
quiz2021_10_12_APSLHL_sigNum(423) → 1
quiz2021_10_12_APSLHL_sigNum(0) → 0

...Save, Compile, Run (ctrl-enter)

public int quiz2021_10_12_APSLHL_sigNum(int num) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 210

Copyright Nick Parlante 2017 - privacy