1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
public class FloatExample { public static void main(String[] args) { // Declaring float variables float pi = 3.14f; float largeNumber = 1234567.89f; float scientificNotation = 6.022e23f; // Avogadro's number // Performing arithmetic operations float sum = pi + largeNumber; float difference = largeNumber - pi; float product = pi * 2; float quotient = largeNumber / pi; // Displaying the results System.out.println("Sum: " + sum); System.out.println("Difference: " + difference); System.out.println("Product: " + product); System.out.println("Quotient: " + quotient); } } |
Welcome to WordPress. This is your first post. Edit or delete it, then start writing!