vb assignment 3

2
Factorial using Sub procedure: Module Module1 Sub Main() Dim num As Integer Console.WriteLine("Enter number") num = Console.ReadLine() factorial(num) Console.ReadLine() End Sub Sub factorial(ByVal a As Integer) Dim c, d As Integer c = 1 d = 1 Do While (c <= a) d = d * c c = c + 1 Loop Console.WriteLine("The factorial of number is {0}", d) End Sub End Module Power fuction: Module Module1 Sub Main() Dim c, d, e As Integer Console.WriteLine("Enter the Base number") c = Console.ReadLine() Console.WriteLine("Enter the Power of above") d = Console.ReadLine e = power(c, d) Console.WriteLine("the power of number is ={0}", e)

Upload: aamir-hussain

Post on 08-Nov-2015

215 views

Category:

Documents


1 download

DESCRIPTION

Vb Assignment 3

TRANSCRIPT

Factorial using Sub procedure:Module Module1

Sub Main() Dim num As Integer Console.WriteLine("Enter number") num = Console.ReadLine() factorial(num) Console.ReadLine() End Sub Sub factorial(ByVal a As Integer) Dim c, d As Integer c = 1 d = 1

Do While (c