Linked Questions

0 votes
1 answer
48 views

I have declared 3 different types of byte arrays(of different sizes). See the comment next to each as I am not able to understand how the length is computed by the compiler? byte[] byteField0 = ...
curiousengineer's user avatar
0 votes
0 answers
33 views

I have a task from school in which I have to display numbers with potencies with the help of system out print. The problem is that all zeroes have to be displayed and that's not working for me. Here'...
Arames's user avatar
  • 1
-3 votes
1 answer
54 views

The error i get is "bad operand types for binary operator ^ first type: float second type: float" this error happens in case 5 of the switch x y and r are floats and n is an Int switch (n) ...
matias valdez's user avatar
0 votes
0 answers
27 views

I was using eclipse recently, trying to make a scientific calculator that performs specific functions when I tried exploring how to put a number to a specific power. As I was exploring how to perform ...
JKristol's user avatar
45 votes
22 answers
304k views

I have the following values: int a=1; int b=0; int c=2; int d=2; int e=1; How do i concatenate these values so that i end up with a String that is 10221; please note that multiplying a by 10000, b ...
Shamli's user avatar
  • 475
62 votes
11 answers
256k views

#include <stdio.h> void main(void) { int a; int result; int sum = 0; printf("Enter a number: "); scanf("%d", &a); for( int i = 1; i <= 4; i++ ) { ...
Abid Ali's user avatar
  • 1,767
59 votes
5 answers
36k views

The following is taken from a job interview: In a given array, which contains integers, each number repeats itself once except for one, which doesn't repeat. Write a function that finds the ...
Adam's user avatar
  • 1,964
31 votes
4 answers
42k views

Many languages have a power operator; why doesn't C++? For example, Fortran and Python use ** and is commonly written (in LaTeX, for example) using ^.
user avatar
7 votes
4 answers
12k views

Does java have a built-in method to compare precedence of two operators? For example, if I have a char '/' and a char '+' is there a method I can call that compares the two and returns true/false if ...
Andrew Keller's user avatar
3 votes
5 answers
6k views

I am calculating the int equivalent of a given set of bits and storing that in memory. From there, I would like to determine all 1 value bits from the original bitmask. Example: 33 --> [1,6] 97 --> [...
tinkertime's user avatar
  • 3,052
3 votes
6 answers
3k views

I want to calculate x power y and both x,y are double values. Why is java giving me a compilation error? What is the best way to do so? I am currently using the following method: x^y // attempt to ...
user378101's user avatar
1 vote
1 answer
9k views

Could anyone explain to me why System.out.println(100*(1-10^(-10/10))); results in the number "800" being printed out? The correct answer is 90 when you use a calculator. How would I go about doing ...
Raymosrunerx's user avatar
2 votes
8 answers
3k views

How would someone implement mathematical formulae in Java? What I mean, the user inputs a string with multiple variables. Like a simple quadratic formula: x^2 + 5x + 10. Or in Java: (Math.pow(x,2)) + ...
Mohit Deshpande's user avatar
3 votes
3 answers
721 views

I have made a program which converts numbers entered into a string into an integer like atoi does, but its giving wrong output. #include<stdio.h> #include<conio.h> #include<math.h> #...
user avatar
4 votes
3 answers
244 views

I have expected both expression's will give same answer: System.out.println(2^0*2); System.out.println((2^0)*2); Output: 2 4 Is there a specific reason why 2^0*2 = 2 and (2^0)*2 = 4?
Prakash VL's user avatar

15 30 50 per page