Questions tagged [integer-division]

Anything related to the integer division operation, i.e. that special form of division which is performed between two integer numbers and which in math results in a quotient and a remainder. This is mostly relevant for languages which have specific integer data-types, for which the division is an integer division, or for languages having a specific operator/function to perform integer division.

Anything related to the integer division operation, i.e. that special form of division which is performed between two integer numbers and which in math results in a quotient and a remainder. This is mostly relevant for languages which have specific integer data-types, for which the division is an integer division, or for languages having a specific operator/function to perform integer division.

619 questions
-1
votes
2 answers

How come my program freezes up when I click calculate?

Here is my code: private void btnCalculateActionPerformed(java.awt.event.ActionEvent evt) { int intInitialInvest = Integer.parseInt(this.txtInputInitialInvest.getText()); int intAnnualInterest =…
-1
votes
2 answers

Division by zero in java

Why is it that division of an integer by 0 gives ArithmeticException whereas division of a non-zero double or float by 0,prints Infinity. Also division of an int 0 by 0 gives ArithmeticException whereas division of a double or float 0 by 0 gives…
Frosted Cupcake
  • 1,909
  • 2
  • 20
  • 42
-1
votes
1 answer

Using the character array as integers

Hello Guys I am trying to solve one problem given on the Hacker Rank. Though the problem is quite simple, I was thinking to solve the problem using some other concepts. The problem is Desription You are given an integer N. Find the digits in this…
Patel
  • 87
  • 8
-1
votes
1 answer

How to count number of divisible terms without using modulus operator?

Given three numbers N, A and B. Find how integers in range from 1 to N are divisible by A or B. I can't use modulus operator from range 1 to N because N can be as large as 10^12 and then I would run out of allocated time for the program to produce…
-1
votes
1 answer

How to Calculate (a/b) %c where a,b and c are very large numbers

I have a function f(x)=(1^1)*(2^2)*(3^3)*.....(x^x) i have to calculate (f(x)/(f(x-r)*f(r)))modulo c i can calculate f(x) and (f(x-r)*f(r)). assume f(x) is a and f(x-r)*f(r) is b. c is some number that is very larger. `` so i how can…
-1
votes
1 answer

Why does running my tests in a different order result in drastically different performances?

I made a program that, for a variety of methods of dividing ints and returning the double result, runs this method for every possible combination of numerators and denominators between 0 and 20, inclusive, and it gave these results for the amount of…
-2
votes
2 answers

How to make C accept if y==0

#include int main() { int x,y,add,subtraction,multiplication,division; printf("Write x:"); scanf("%d",&x); printf("Write y:"); scanf("%d",&y); add = x+y; printf("Add=%d\n",add); subtraction = x-y; …
Vladyslav
  • 35
  • 5
-2
votes
3 answers

Is there a way to know if an integer division operation had a remainder?

I don't want to know what the remainder is, I just want to know if there was a remainder as a boolean value. As such, using the modulo operator is not what I'm looking for. Something in C would be preferable, but any language works.
-2
votes
4 answers

C++ problems with division

I need to make a program in C++ in which I insert a number 'n' that's with 4 digits and it's a simple number, in the console and the console is showing me the multiplication of the certain number with 4 digits which I first needed to write. I tried…
-2
votes
1 answer

CONVERT StringVar to Float

I'm a beginner in programming and I'm trying to write a calculator code. I had a problem with the outputs because I give the input as an str with StringVar(), but this prevents me to do decimal divisions such as a simple "54/10" for example. Is…
-2
votes
2 answers

C: Unable to use modulus operators to break down change into denominations, storing into an array and print the output to the user

I'm attempting to write a program in which: The user inputs the cost of an item The user inputs the amount they paid for the item The program determines if the user is owed any change The program calculates the amount of change owed The program…
hailnolly
  • 33
  • 1
  • 10
-2
votes
5 answers

Sum of all integer divisors of a number

I want to find sum of all divisors of a number i.e. if the number is 6 i want to have 1+2+3+6=12. My attempt to approach it is: #include using namespace std; int divisorsSum(int n){ int sum=0; for (int i=1; i<=n; i++){ …
Mrowkacala
  • 153
  • 2
  • 2
  • 10
-2
votes
7 answers

Divide by 9 without using division or multiplication operator

This question I have tried to solve it but couldn't get any way. Any pointers would be appreciated. Regular subtraction way of doing division is not the intention here, ingenious way of using shifting operator to get this done is the intention.
newbie_old
  • 500
  • 5
  • 19
-2
votes
1 answer

Excel Spreadsheet not giving same answer as C# program

I have trouble with the following code. It is not giving the same answer in excel as C# and I'm sure the excel answer is correct. I have already tried to change integer values to double by adding a decimal point. Please advise. the excel…
Alfred Waligo
  • 2,809
  • 3
  • 18
  • 26