How to use Mode in Vb.Net
Module Module1
Dim n, i, sum, m As Integer
Sub Main()
Console.WriteLine("Enter the number")
n = Console.ReadLine()
m = n
For i = 1 To n - 1
If (n Mod i = 0) Then
sum = sum + i
End If
Next i
If (sum = m) Then
Console.WriteLine("It is perfect number")
Else
Console.WriteLine("Not perfect number")
End If
Console.ReadLine()
Module Module1
Dim n, i, sum, m As Integer
Sub Main()
Console.WriteLine("Enter the number")
n = Console.ReadLine()
m = n
For i = 1 To n - 1
If (n Mod i = 0) Then
sum = sum + i
End If
Next i
If (sum = m) Then
Console.WriteLine("It is perfect number")
Else
Console.WriteLine("Not perfect number")
End If
Console.ReadLine()
0 comments: