numbers

Simplifying Fractions With java

纵饮孤独 提交于 2019-12-13 06:29:15
问题 Hey guys I am working on a SW here I am kinda in need of help, you see we need to make a method where we are gonna simplify fractions. any idea how? here's my code as of now (don't mind the dvalue Method it is already finsih all I need is the simplify method) public class Fraction { public int num; public int den; public double dValue; public void display() { System.out.println("Numerator: "+num); System.out.println("Denominator: "+den); } public double dValue() { dValue = (double)num/den;

gmp_pow() will not accept a GMP number for exponent

筅森魡賤 提交于 2019-12-13 06:15:03
问题 I am playing around in PHP with RSA and big numbers. I need to be able to take numbers to the power of an exponent that has ~256 to ~512 bytes using gmp_pow(). Does anyone have any suggestions? 回答1: You should use gmp_powm() which automatically reduces the intermediate values to be less than the modulus value. This exactly what you want for RSA. gmp_pow() doesn't accept an exponent large than a long since the intermediate values will be larger than the addressable memory in your computer. 来源:

Location of Largest Number in an Array

£可爱£侵袭症+ 提交于 2019-12-13 05:53:50
问题 My program is supposed to prompt the user to input the number of rows and columns in an array and then input the array. The location of the largest element in the array is then calculated and displays. My code keeps displaying (0,1) instead of the actual result, (1,2). Any ideas? My code: import java.util.Scanner; public class Question8_13 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the number of rows and columns in the array: ");

C++ comparing two numbers by their digits

最后都变了- 提交于 2019-12-13 05:28:56
问题 I want to make a function, which returns true whenever two numbers provided on input are made up of the same digits (with no replacement). For example, 543 and 435 should return true, 10001 and 11000 should return true, but 111222 and 122222 should return false. I've read something about bitmasks but do not really get it, could You help me? 回答1: The simplest way I can think to handle this is to use buckets. Create an std::vector of length 10 (one for each digit) and then increment an index

How to find a nearest higher number from a specific set of numbers :javascript [duplicate]

大城市里の小女人 提交于 2019-12-13 05:25:18
问题 This question already has an answer here : How to find a same or nearest higher number from a specific set of numbers :javascript (1 answer) Closed 3 years ago . I have a set of numbers & my requirements is to find same or nearest higher number to a specific variable set/object of numbers var person = { A:107, B:112, C:117, D:127, E:132, F:140, G:117, H:127, I:132, J:132, K:140, L:147, M:117, N:127, O:132 }; I need to find a nearest higher number to vaiable x eg1- if x = 116; then nearest

Assembly Conversion any base to any base

旧巷老猫 提交于 2019-12-13 05:11:08
问题 i'm doing a program to input a number and base, and convert this number to any base. In this initial fase, i get from the user the number and base, the question is.. How i can verify if the number is from that base? NUMBER_INPUT PROC jmp @again @ERROR: LEA DX, ILLEGAL MOV AH, 9 INT 21H @AGAIN: print num MOV CX, 8 XOR BX, BX MOV AH, 1 @INPUT: INT 21H CMP AL, 0DH JE @END CMP AL, 30H JL @ERROR ; CMP AL, 31H ; JG @ERROR AND AL, 0FH SHL BX, 1 OR BL, AL LOOP @INPUT @END: RET NUMBER_INPUT ENDP BASE

Add random variable after image url with javascript

夙愿已清 提交于 2019-12-13 04:34:26
问题 I have a page with an image on it, however this image changes quite frequently, but it has the same URL. To bypass the browser from caching an older version of the image, I want to add a random number variable after the URL. What is the best way to do this with Javascript? So when the page loads, it does not load: http://test.com/image.png instead it loads: http://test.com/image.png?43673890 So each time the page is reloads, it has a new variable so the latest version of the image is visible.

Fibonacci calculation

隐身守侯 提交于 2019-12-13 04:29:30
问题 This program is supposed to get a Fibonacci number from the user and the program will calculate what it is while making sure that the user entered a positive number and a number no less than the Fibonacci number 70. So, if the user entered 7, it should print 13. The method fibcalc() is supposed to do the calculations. When I try and compile the program, I get the errors "method fibcalc in class Fibonacci cannot be applied to given types: System.out.printf("Fibonacci #%d is %f", num, fibcalc

How to raise or decrease a display number variable in AS3 with a condition?

泄露秘密 提交于 2019-12-13 04:22:10
问题 I've got, in my Toolbar.as class, a simple variable (4-digit number) displayed in a dynamic text box, like that : var number = 9999; useText.text = String(number); trace(number); In my puzzle class I have a condition and I would like to decrease the number if it's true. How can I do that ? For exemple, I've got, in my Puzzle.as class : if (inv.containsItem("rock")) { toolbar.useText.text = "String(number)" - 100; } But it doesn't work (I know that I have to change the "String(number)" - 100

Currency to words mispelling problems

和自甴很熟 提交于 2019-12-13 04:15:17
问题 This is the code below for converting numbers to words. What is the exactly problem ? Everything is great in English but in my country (Romania) there is different spelling let's make that clear in a few examples : Ex. 1 - English, One dollar,One thousand, One hundred, Two hundred that's how you write Romanian, Un dollar, O mie, O suta, Doua Sute, Trei Sute, there is a plural changing on the words, In English you use One for everything almost in Romanian this changes and I don't know how to