Home >>VB.Net Programs >VB.Net program to demonstrate the use of Math.IEEERemainder() method

VB.Net program to demonstrate the use of Math.IEEERemainder() method

Write a VB.Net program to demonstrate the use of Math.IEEERemainder() method

Here, using the IEEERemainder() method of Math class, we can find the remainder from two defined double type numbers.

Program :

Below is the source code for demonstrating the use of the Math.IEEERemainder() method. The program given is compiled and successfully executed.

Example


Module Module1
    Sub Main()
        Dim num1 As Double = 0
        Dim num2 As Double = 0
        Dim remainder As Double = 0
        Console.Write("Enter the number1: ")
        num1 = Double.Parse(Console.ReadLine())
        Console.Write("Enter the number2: ")
        num2 = Double.Parse(Console.ReadLine())
        remainder = Math.IEEERemainder(num1, num2)
        Console.WriteLine("Remainder : {0}", remainder)
    End Sub
End Module
	
Output:
Enter the number1: 5.25
Enter the number2: 2.1
Remainder : 1.05

Explanation:

We created a Module1 module in the above program that contains a method Main(). We created three num1, num2, and remaining variables in the Main() method that are initialized with 0.

Console.Write("Enter the number1: ")
num1 = Double.Parse(Console.ReadLine())

Console.Write("Enter the number2: ")
num2 = Double.Parse(Console.ReadLine())

We read the value of the num1 and num2 user variables here.

remainder = Math.IEEERemainder(num1, num2)
Console.WriteLine("Remainder : {0}", remainder)

Here, using IEEERemainder(), we calculated the remainder and printed the result on the console screen.


No Sidebar ads