# Questions tagged [integer]

Common datatype in many programming languages for representing a whole number. Use this tag for questions about using, storing, or manipulating integers.

**0**

votes

**1**answer

16 views

### How to get value of variable entered from user input with really easy way? [duplicate]

i want to Write a piece of code that repeatedly asks for input until the user enters your first name correctly. Once the user enters specific name, print a positive message congratulating the user. if ...

**2**

votes

**0**answers

26 views

### Php (int) parse weird result explanation [duplicate]

Why does this code:
echo (int)((0.1+0.7)*10);
Return 7?
Is this because of some weird approximation algorithm of math operations in php causing 0.1+0.7 to be almost 0.8 and not exact 0.8?
It ...

**0**

votes

**2**answers

34 views

### input for loop integers and decimal numbers

I should make the input to take different numbers on a new line and find the average, but my program does this only with integers. How can I make the input to take not only integers but numbers like 2....

**0**

votes

**0**answers

13 views

### Adding Six UiTextFields together to be Display in a Label

I am trying to add six UITextFields together like an excel spread sheet would list the totals. What I tried was..
let w1 = Double(weightOne.text!)
let w2 = Double(weightTwo.text!)
let w3 = Double(...

**-2**

votes

**5**answers

46 views

### How to check if an integer larger than Integer.MAX_VALUE [duplicate]

Suppose I have an positive int x; I want to double x until it is larger than Integer.MAX_VALUE then stop.
I know MAX_VALUE = 2^31-1 and if x goes beyond this value, overflow occurs, and x becomes ...

**0**

votes

**1**answer

21 views

### How do I split an SQL column that is part string part number with variable length

I have an ID column that uses letters and numbers: A00055 or AI000075 for example.
The text values are in ascending order by ASCII code so I was going to do something like this:
CAST((COALESCE(...

**0**

votes

**0**answers

16 views

### Compare long types [duplicate]

I have created a function calculating the faculty of integers up to 20, I now need to test the function. First I tried to create an ArrayList and adding all the values for n!, n = 1, 2, ..., 20 to it ...

**-3**

votes

**2**answers

43 views

### class 'int' instead of type 'int': string indices must be integers

I have a simple Python function where I'm swapping values in a string. I'm doing this by generating a pseudorandom integer, then swapping it with the next index or previous index to avoid out of ...

**0**

votes

**1**answer

33 views

### Only Need to write Junit for Integer.valueOf() in Java

So here is the thing, I found new Integer() in my code and which is deprecated now I planed to remove that pic of code (new Integer()) to Integer.valueOf() but as company rules I have to write the ...

**1**

vote

**3**answers

23 views

### Insert int type variable from EditText into SQL Database in Android

I got an EditText and I want to insert an int type variable into my database. If I insert a number, everything's ok. But if I left the EditText empty, the app crashes. This is the code that handles ...

**0**

votes

**0**answers

33 views

### Storing a variable so that it is the same the next time the class is accessed

How do you store a variable so that when you're accessing a class, the variable is the same as before? In the main method the class is accessed once and I want to add the name to the array and ...

**-1**

votes

**0**answers

26 views

### Problem: how do i store integer in my.settings vb.net

I've created an application for running tournaments and it works perfect but if I close the app and open it again my integer value's will not store in my.settings I know they work through testing but ...

**0**

votes

**5**answers

29 views

### List of 10 random points between -2 and 2 with uniform distribution

How do I make a list of 10 random points between -2 and 2 with a uniform distribution? Python keeps telling me that the range is negative or too small
This is what I have so far:
import random
...

**0**

votes

**0**answers

9 views

### Convert a scale to an integer

I am currently teaching myself tkinter and I haven't got too far. I need to use the scale option to choose the length of my password, and then press a button and it will generate a random password. ...

**-2**

votes

**0**answers

26 views

### difference between DEC int vs HEX int in a function call

main()
{
int x;
int y;
int z;
x =y/z;
test(x);`//takes input in hexa decimal format as test uses bit wise operator
}
/*should I can make int x to int 0x0x?Let say the function test decide based ...

**0**

votes

**1**answer

26 views

### What should the maximum difference be between a float and a 16 bit calculation?

Lets say I have a formula that calculates a value. I can calculate the value either with floating point arithmetic or with fixed point arithmetic (using 16 bit integers).
What should be the maximum ...

**0**

votes

**1**answer

14 views

### Airtable If-statement outputting NaN

I'm using an If-statement to assign integers to strings from another cell. This seems to be working, but if I reference these columns, I'm getting a NaN value. This is my formula below. I tried adding ...

**1**

vote

**3**answers

30 views

### Double with custom quantity zero's after dot

I have two Integer values and I need create Double value from combining this two values in following way:
A.CB
where:
A — first integer value
B — second integer value
C — zero's to match total ...

**1**

vote

**1**answer

34 views

### Matlab: random integers from a range with no repetition

I want to get an array with randomized integer included in range with no repeat, I used :
randperm(15,3)
output is :
8, 10, 12
This function not use a range, I would like to random values only ...

**0**

votes

**3**answers

35 views

### Convert a column of dates from ordinal numbers to the standard date format - pandas

I have to convert a column of dates from the integer/date format to the date format d-m-Y. Example:
import pandas as pd
col1 = [737346, 737346, 737346, 737346, 737059, 737346]
col2 = ['cod1', 'cod2', ...

**0**

votes

**1**answer

26 views

### Check for integer value vs float value

I
My vba doesnt seem to quite work. I need it to multiply a value in column N by 2 if it is a decimal and do nothing for all other values.
currently it is
Sub multiply()
Dim i, j, k, l As Integer
...

**-2**

votes

**2**answers

41 views

### How to pick a random integer out of three integers I chose

I am making a trivia game and have questions in functions to get a random question I am trying to pick a random integer that is 0, 1, or 2. Depending on what I get I will then point to a function and ...

**0**

votes

**1**answer

20 views

### Is it possible to convert a string of integer values to fit into a 3 x 3 array?

I have a string:
1 2 3 4 5 6 7 8 9
and an empty 3 x 3 array:
int[][] grid = new int[3][3];
I want the string to be stored in the grid such that:
{{1,2,3},{4,5,6},{7,8,9}}
Is there any way of ...

**-1**

votes

**2**answers

34 views

### 32 bit to decimal converter in Python w/ functions [closed]

I've been researching for some time now how to begin writing a program that can take a 32 bit integer and convert it to a dotted-decimal integer, however I've had no luck. I'm very new to coding and I ...

**0**

votes

**3**answers

63 views

### Ansible: how to convert list into integer

i have the following json output
"lc_facts": {
"changed": false,
"failed": false,
"launch_configurations": [
{
"block_device_mappings": [
...

**-3**

votes

**3**answers

72 views

### Factorization of really big numbers in C

I am writing an article regarding the importance of the Prime numbers on today's criptography. I want to develop a small application showing how long a program written in C (low level language, at ...

**0**

votes

**1**answer

14 views

### What Does x-bit integer mean?

I have a very basic question related to the data type.
if I have one array of let say 5 elements
x = [3.23 1.47 3.79 8.91 6.01],
and it's data type is 8-bit integer.
Does it mean that each entry ...

**0**

votes

**1**answer

47 views

### Finding largest sum of consecutive numbers in an array

I have a few questions for this program I am making to find the largest sum of consecutive numbers in a list. Mind you, this is not the same as finding the largest sum of contiguous integers in an ...

**-1**

votes

**1**answer

16 views

### Uses deprecated method java/lang/Integer::<init>(Ljava/lang/String;)V

I am working on java version upgrade and I have to fix following statement :
Message: class masthead/auth/mesdb/MesDbAuthLogDAO uses deprecated method java/lang/Integer::(Ljava/lang/String;)V
@...

**3**

votes

**5**answers

91 views

### return list with integers and string from list of strings

['10019', 'Airma25KLOS', 'Juridinis', 'LT', '121979631', 'LT219796314', '2410', '25', '26', '3232', '32131']
In this list every item is a string, how could I make from this list, same list with same ...

**-1**

votes

**1**answer

17 views

### Convert an hex string into int using c#

I need to convert a string which cointains an hex value into an 8 bit integer.
For example I have a string
test="3A"
I would like to convert into int which means 58.
Is there a particular function?...

**0**

votes

**2**answers

44 views

### How to Split a byte into 2 parts and read it? [duplicate]

I encountered this problem on a task given to me.
Here's the situation:
If the user clicks on "Vat First" then the value is 0.
Else, the value is 1.
Then, in this Textbox,
The range of the ...

**0**

votes

**3**answers

37 views

### How to define a method with Integer parameter (path placeholding)?

Preface
I'd like to saying two things:
I don't know how to phrase this question in a few words. So I can't find what I'm looking for when searching (on stackoverflow). Essentially, I apologize if ...

**3**

votes

**1**answer

69 views

### Map java enum's to integers [duplicate]

I want to map integers to enums in Java. The integer needs to be the key and the enum is the value. All examples I've seen has the enum as the value and the integer as the key. I have:
enum ...

**0**

votes

**1**answer

55 views

### C programming - unsigned int overflow problem

I want to print out an integer type variable which value is 3000000000;
So I wrote the below code then ran it, but the printed value was incorrect. I think the variable is overflowed. But I don't ...

**1**

vote

**1**answer

64 views

### Increasing integers sequence

In an inteview, i was asked to find the answer to the following algorithm question.
Suppose you get a short input of increasing integers, say, "2 4", can you figure out what integers come after 4? If ...

**-2**

votes

**1**answer

51 views

### how do i convert a line of integer into array (or vector);

I have a long double x,y, entry which outputs these numbers;
output of x:
5
1
1
2
2
3
3
4
5
5
5
the numbers in x above are represented vertically
this is the code here;
stringstream sa(...

**3**

votes

**1**answer

79 views

### Recreating JS bitwise integer handling in Python3

I need to translate a hash function from JavaScript to Python.
The function is as follows:
function getIndex(string) {
var length = 27;
string = string.toLowerCase();
...

**0**

votes

**1**answer

26 views

### Make Python print whether a integer is positive or negative

Is there any method to add a '+' in front of a integer if the number is positive and a '-' in front of a negative integer.
i know this is fairly simple using if x > y and so forth but it seems a lot ...

**-3**

votes

**1**answer

58 views

### C: get the bits of an integer

I have a program that will take two 4-byte integers as input and I need to store these into integer arrays like so...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int ...

**3**

votes

**1**answer

33 views

### How to use 64-bit unsigned integer math in Python, respecting C overflow?

I'm trying to implement the djb2 hash in Python.
Here it is in C:
/* djb2 hash http://www.cse.yorku.ca/~oz/hash.html */
uint64_t djb2(size_t len, char const str[len]) {
uint64_t hash = 5381;
...

**1**

vote

**2**answers

48 views

### Manipulating an Integer Object Without creating a new Instance?

I have:
// lets call this Integer reference ABC101
Integer i = new Integer(5);
//j points to i so j has the reference ABC101
Integer j = i;
//creates a new Integer instance for j?
j++;
//I want j++ ...

**0**

votes

**0**answers

13 views

### How to query a table to show all rows where column values are integers?

I have a list of properties in a MySQL table whose cities are identified by integers. They are not unique - there may be several rows that contain the same integer.
If I am querying this table, how ...

**1**

vote

**1**answer

20 views

### Writing simple spreadsheet processor for class. The Location class' methods don't pass unit testing. Any help on why?

Writing up a program for a class and I have the specification to do this: A class that fully implements the Location interface, and contains a constructor taking a single String parameter (e.g., “D20”)...

**-1**

votes

**1**answer

33 views

### entry widget validation with tkinter for both integers and floating point values

So i have some code which can be used to validate an entry widget so that only integer values can be inputted. I would like to achieve the same effect but instead of only integer values both integer ...

**0**

votes

**1**answer

26 views

### Convert multiple hex values to decimal separated by commas

I am doing an analysis of a csv file that has multiple columns and rows.
I am pulling specific data from the csv file and importing the data into
a datagridview. I would like to pull data from a ...

**1**

vote

**2**answers

66 views

### How to make an array of integer arrays in Java?

I have been trying to make an array of integer arrays. I know that the outer array will have length N whilst every integer array within in only needs to hold two values.
Originally, I made an ...

**0**

votes

**0**answers

25 views

### Comparing Strings and Integers

Why is it that 55 !="hello" is true while "hello" > 35 gives you an error since there are two different data types?
I tried seeing if leaving hello without quotes would help, but you get an error ...

**0**

votes

**0**answers

29 views

### Django IntegerField in PostgreSQL getting a “numeric field overflow” error at 1000

Context: I have moved my project from a local SQLite database into an AWS RDS PostgreSQL database. It was a blank database so migrations went fine, but now that I'm testing actually saving data, I'm ...

**-2**

votes

**2**answers

41 views

### Having trouble figuring out how my code can count integers

I have this project for a class that required me to write a program in C so that it calculates the number of words, characters, and integers in a file.
So far I have been able to make it calculate ...