answersLogoWhite

0


Best Answer

Some smart compilers will not allow you do that. If you managed to do that, there are couple different results, the most predictible is decimal part will be cut, only what left will be shown. If it exceed the amount of memory reserved for int (double > float > int), it will show the maximum or positive or negative value for int type, or it will shifted by some amount from the maximum or minimum.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What happens if you assign a number with a decimal to an integer?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

In many languages it is an error to assign a real number to an integer variable True or False?

true


Will the output of ADC be an integer or will it be a decimal also?

You will have to determine its scaling factor. The output of the ADC is a number, you can interpret it anyway that is necessary for the system it is in.


What is the INT functions?

The INT function is to convert something into an integer. An integer is a number that goes out two decimal places.


What is the formula that would get the tenths digit number in a three digit integer number?

In a three digit integer number the tenthsdigit is always 0 as integer numbers are whole numbers and have no decimal part and tenths are decimal parts:tenths_digit_of_integer_number = 0I suspect you mean "How to find the tens digit of an integer number?"; this is the second from the right, so:tens_digit = (INT(number ÷ 10)) MOD 10For example, in C this would become: tens_digit = (number / 10) % 10;


How do you write a Java program to convert a decimal number to an octal number?

public class Dataconversion { public static void main(String[] args) { System.out.println("Data types conversion example!"); int in = 44; System.out.println("Integer: " + in); //integer to binary String by = Integer.toBinaryString(in); System.out.println("Byte: " + by); //integer to hexadecimal String hex = Integer.toHexString(in); System.out.println("Hexa decimal: " + hex); //integer to octal String oct = Integer.toOctalString(in); System.out.println("Octal: " + oct); } }

Related questions

Is a decimal number an integer?

A decimal number is not an integer. An integer is a number that is not a fraction, and decimal numbers are decimal fractions.


Would a decimal be an integer?

No by definition a decimal number can never be an integer because an integer is a whole number (it can not have any decimal parts).


Is decimal an integer number?

No, an integer is a whoe number. Therefore, not a decimal number (e.g. 1.7)


Is -1.3838 an integer?

No. It is decimal number. An integer is a number that can be written without a fractional or decimal component.


Can integers be decimal numbers?

Oh honey, bless your heart. Integers are like the good ol' whole numbers - no decimals allowed. They're like the stubborn old grandpa who refuses to budge from his ways. So, nope, integers and decimals don't mix.


Is 9.5 an integer number?

No, 9.5 is not an integer number. An integer is a whole number that can be positive, negative, or zero, without any decimal or fractional parts. In this case, 9.5 has a decimal part (.5), making it a decimal number rather than an integer.


Is 14.5 an integer?

The number 14.5 is a decimal and not an integer. An integer is any number which is a whole number.


Is a decimal a positive integer?

A decimal is not an integer. However a number with a decimal component can be either positive or negative


Is 184 a integer?

An integer is a number that has no decimal. Yes, 184 is an integer.


Is 78 an integer?

No, it is a decimal number.


Is -35 An Integer?

No, to be an integer a number must not have a decimal value.


Is 0.36 a integer?

No, any number with a decimal point is not an integer, it is a real number.