Monthly Archives: March 2017

Java example: input from keyboard

In Java you can define several “primitive” data types: byte – signed integers in [-128,127] (8 bit) short – signed integers in [-32768,32767] (16 bit) int – signed integers in [-231,231-1] (32 bit) long – signed integers in [-263,263-1] (64 bit) float – floating point in [1.4*10-45,3.4028235*1038] (32 bit) double – floating point in [4.9*10-324,1.7976931348623157*10308]

Java example: factorial

More info on factorial: https://en.wikipedia.org/wiki/Factorial While-Do version: Comments: line 5: declare 2 integer variables, one is called N and one is called F line 7: N is initialized with a value of 4 line 9: F is initialized with the same value of N line 11: the While-Do starts with a condition check if the