CSE 114 Study Guide - Final Guide: Modulo Operation, Binary Number

22 views1 pages

Document Summary

Be sure to show your code to one of the lab tas before you leave, so that you can receive credit for this lab. For example, given the input 12345, the method would print out 54321. Use the following method header: public static void reversedisplay (int value) Hint: use modulo (%) and division to extract digits from a number. The header for this method is: public static string dec2bin (int value) Remember that the general procedure of converting a base 10 value into a new base n involves repeatedly dividing the value by n and taking the remainders in reverse order (from last to first, left to right). As with the preceding program, use the modulo operator to compute the remainder of dividing by 2. In this case, use a value less than 2 as your base case (e. g. , 0 in decimal is 0 in base 2, and 1 in base 10 is 1 in base 2).

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers

Related Documents