You are on page 1of 7

Program 1 //Write a program to check whether the given number is odd or even

Module Module1 Sub main Dim a as Integer Console.WriteLine(Enter value for a) a = Console.ReadLine() if a mod 2 Then Console.WriteLine(a & is even Number) Else ConsoleWriteLine(a & is odd Number) End if Console.ReadLine() End sub End Module

Program 2
//Write a program to find maximum form given numbers
Module Module1 Sub main Dim a,b,c as Integer Console.WriteLine(Enter value for a :-> ) a=Console.ReadLine() Console.WriteLine(Enter value for b :-> ) b=Console.ReadLine() Console.WriteLine(Enter value for c :-> ) c=Console.ReadLine() if a>b Then Console.WriteLine(a & maximum number) Else if a>c Then Copnsole.WriteLine(a & maximum number) Else if b>c Then Console.WriteLine(b & maximum number) Else Console.WriteLine(c & maximum number) Console.ReadLine() End sub End Module

Program 3
//write a program to calculator the are of circle
Module Module1 Sub main Dim r,ans as Single Console.WriteLine(Enter value for radius :) r=Console.ReadLine() ans =3.14*r*r Console.WriteLine(Area of the circle is & ans) Console.ReadLine() End sub End Module

Program 4
//write a program to calculate factorial of a given number.
Module Module1 Sub main Dim a,i as integer Dim fact as Integer=1 Console.WriteLine(Enter Numbner :- ) a=Console.ReadLine() i=1 While i<n Fact=fact*i I=i+1 End While Console.WriteLine(Facturial of the given number is = & fact) Console.ReadLine() End sub End Module

Program - 5
//write a program ti calculate xn / n!
Module Nodule1 Sub main Dim x,n,,I,j as Integer Dim sum as Integer=1 Dim fact as Single=1 Dim ans1 as single J=1 Console.Writeline(Enter value for x :- ) x=Console.Readline() Console.Writeline(Enter value for n :- ) n=Console.Readline() while i<n sum =sum*x i=i+1 End while for j =1 to n fact=fact * j Next ans1 = sum/fact Console.Writeline( Your final answer is & ans1) Console.Readlline() End sub

End Module

Program 6
//write a program with create a one class calculate in which define the function add which add two integer,three integer, two single and one integer.
Module Module1 Overload public function add(a as integer,b as integer) add=(a+b) End function Overload public function add(a as integer,b as integer,c as integer) add=(a+b+c) End function Overload public function add(a as single,b as single,c as integer) add=(a+b+c) End function Sub main Dim ans,ans1 as integer

Dim ans2 as single Dim c1 as new add ans = c1.add(5,6) ans1 = c1.add(5,6,7) ans2 = c1.add(2.5,1.5,3) Console.Writeline(Addition of two integer number is & ans) Console.Writeline(Addition of three integer number is & ans1) Console.Writeline(Addition of two single and one integer is & ans2) End sub End Module

You might also like