Exercise
Division of two numbers
Objetive
Write a C# program to print the result of dividing 24 by 5 on the screen.
Example Code
using System; // Importing the System namespace to use Console functionalities
// Main class of the program
public class Program
{
// Main method where the program execution begins
static void Main()
{
// Declaring two integer variables with values 24 and 5
int num1 = 24;
int num2 = 5;
// Calculating the result of the division of num1 by num2
double result = (double)num1 / num2; // Casting to double for decimal result
// Printing the result of the division to the screen
Console.WriteLine("The result of dividing 24 by 5 is: " + result);
}
}