+ 8

I don't understand the question...

A question in challenge has confused me. Q: What value can "int" have? 1. whole numbers (correct) 2. text 3. characters 4. any number (my choice) What does that mean by "whole numbers" and "any number" ?

20th Jul 2019, 10:59 AM
你知道規則,我也是
你知道規則,我也是 - avatar
8 Answers
+ 13
int variable can only store whole numbers. But I think even if the number is not a whole number like 3.5 there will be implicit type conversion.
21st Jul 2019, 3:50 AM
Manoj
Manoj - avatar
+ 7
Thanks! I thought whole numbers were something like containers or arrays. 😅
20th Jul 2019, 12:03 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 4
int variable can store integer (whole number) values, such as 123; but cannot store real numbers ("any numbers"), such as 12.34. See for example Java -> Basic Concepts -> Variables
20th Jul 2019, 11:24 AM
dozule
dozule - avatar
+ 3
Yeah, these kind of questions are kind of stupid :/ A whole number means that it doesn't have a decimal point Any number means it can have a decimal point 3 -> Integer 3.5 -> Not an integer
20th Jul 2019, 11:24 AM
Airree
Airree - avatar
+ 2
an int can have only whole numbers like 0,1,2,3,4,5,6,7,8,9,10....... any number can include decimal numbers but whole numbers are just what I described above . Thanks
21st Jul 2019, 7:49 AM
ArSlan Mehmood
+ 1
Whole number is the correct answer.Not whole text such as #include <stdio.h> int main(){ int age=46; printf("age"); }
21st Jul 2019, 4:39 PM
Anonymous
Anonymous - avatar
+ 1
Integers can hold positive or negative whole numbers as well as 0.
22nd Jul 2019, 1:32 AM
Sonic
Sonic - avatar
0
Fill in the blanks to retrieve the number of elements in an array called "test". test.
21st Jul 2019, 8:55 AM
Ayush Pandey
Ayush Pandey - avatar