Slides
14 slides

Integers.pptx

Published Mar 10, 2013 in Education

In computer science, the term integer is used to refer to any data type which can represent some subset of the mathematical integers. These are also known as integral data types.

### Other Slide by  by UVOICE

### Steffanie & Jan Hospitals Presentation PPTX

Published April 13, 2013 under Progamming  by UVOICE

### Steffanie & Jan Hospitals Presentation PPTX

Published April 13, 2013 in Progamming  by UVOICE

### Steffanie & Jan Hospitals Presentation PPTX

Published April 13, 2013 in Progamming

### Presentation Slides & Transcript

#### Presentation Slides & Transcript

Integers
By Vinson Ly
Block 2-4
1
9
2
3
4
5
6
7
8

The name integer, derives from the Latin integer (meaning literally "untouched," hence "whole”. The set of all integers is often denoted by a boldface Z for Zahlen (German for numbers).

What are integers?
In computer science, the term integer is used to refer to any data type which can represent some subset of the mathematical integers. These are also known as integral data types.
-1
-3
7
2
5
-6
-8
4
9

An integer is a whole number (not a fraction) that can be positive, negative, or zero. Therefore, the numbers 5, 0, -45, and 5,148 are all integers.

When two integers are added, subtracted, or multiplied, the result is also an integer.

Here are some examples. X equals 10 – 3 and 7 is printed to the console. X equals 5 times 3 and 15 is printed to the console.

When one integer is divided into another, the result may be an integer or a fraction.

Here are some examples. X equals 6 divided by 3 and 2 is printed to the console. When 7 is divided by 3 the answer is not an integer but is a continuous decimal.

The Use of Integers
var rectangle = new Object();
rectangle.length = 3;
rectangle.width = 4;
Integers are a commonly used data type in computer programming. In this piece of code, integers represent the rectangle’s length and width.

For Loops

var i;

for (i = 2; i <= 6; i+=2) {
console.log(i);
}
Variables work together with integers in loops. In this for loop, the variable i is being incremented by 2.

While Loops
var i =1;
while(i<=5){
console.log(i);
i+=2;
}
In this while loop, the integer 5 is when the loop stops and i is incremented by 2 each time.

numbers = [1,2,3];

var number = 123
Integers is a data type so it is information that can be stored in arrays, variables, etc. The top piece of code is an array and the bottom piece of code is a variable.

var myName = “Vinson”;
var myAge = 15;
console.log(myName + “ is “ + myAge);

The integer 15, is used to represent Vinson’s age and is stored in the variable, myAge.

Thank you for your watching, I hope you learnt something from this presentation.