Exercise
Division of two numbers
Objetive
Write a java program to print the result of dividing 24 by 5 on the screen.
Example Code
// Main class definition
public class Program {
// Main method, entry point of the program
public static void main(String[] args) {
// Declare and initialize two integers
int dividend = 24;
int divisor = 5;
// Calculate the division result as a double to allow decimal places
double result = (double) dividend / divisor;
// Display the result of the division on the screen
System.out.println("The result of dividing 24 by 5 is: " + result);
}
}