BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan Right Header

HOME BZU Mail Box Online Games Radio and TV Cricket All Albums
Go Back   BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan > Institute of Computing > Bachelor of Science in Information Technology > BsIT 5th Semester > Visual Programming

Visual Programming Sir Ahsan


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 21-12-2009, 02:25 AM
.BZU.'s Avatar


 
Join Date: Sep 2007
Location: near Govt College of Science Multan Pakistan
Posts: 9,693
Contact Number: Removed
Program / Discipline: BSIT
Class Roll Number: 07-15
.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute
Default VB Programs by Ahmad Mushtaq

Code:
Factorial Program

   
  Module Module1
   
   Sub Main()
   Dim input As Integer
   Dim result As Double
   
          Console.WriteLine("Please input your value for factorial")
          input = Console.ReadLine
   
          result = calculateFactorial(input)
   
          Console.WriteLine(result)
          Console.Read()
   
   End Sub
   
   Function calculateFactorial(ByVal number As Integer) As Double
   Dim factorial As Double = 1.0
   For i As Double = 1.0 To number
              factorial = factorial * i
   Next
   Return factorial
   End Function
   
  End Module
   
   
   
   
   
  Calculating power of any given number

   
  Module Module1
   
   Sub Main()
   Dim number, power As Integer
          Console.WriteLine("Please input the number")
          number = Console.ReadLine()
   
          Console.WriteLine("Please input the power")
          power = Console.ReadLine()
   
          Console.WriteLine("The result of {0}^{1} is " & number ^ power, number, power)
          Console.ReadLine()
   End Sub
  End Module
  
  Determine if a number is even or odd:

   
  Module Module1
   
   Sub Main()
   
   Dim myNum As Long
          Console.WriteLine("Please insert the value to be checked: ")
          myNum = Console.ReadLine
   
   If myNum Mod 2 Then
              Console.WriteLine("You've entered an odd number.")
   Else
              Console.WriteLine("You've entered an even number.")
   End If
          Console.Read()
   
   End Sub
  End Module
   
   
  Find Max number among 3 numbers:

   
  Module Module1
   
   Sub Main()
   Dim max, num1, num2, num3 As Integer
          Console.WriteLine("Please insert the first number:")
          num1 = Console.ReadLine()
          Console.WriteLine("Please insert the second number:")
          num2 = Console.ReadLine()
          Console.WriteLine("Please insert the third number:")
          num3 = Console.ReadLine()
   
   If num1 > num2 And num1 > num3 Then
              max = num1
   ElseIf num2 > num1 And num2 > num3 Then
              max = num2
   ElseIf num3 > num1 And num3 > num2 Then
              max = num3
   
   End If
          Console.WriteLine("The maximum number is {0}", max)
          Console.ReadLine()
   End Sub
   
  End Module
  
  Find Min number among 3 numbers:

  Module Module1
   
   Sub Main()
   Dim min, num1, num2, num3 As Integer
          Console.WriteLine("Please insert the first number:")
          num1 = Console.ReadLine()
          Console.WriteLine("Please insert the second number:")
          num2 = Console.ReadLine()
          Console.WriteLine("Please insert the third number:")
          num3 = Console.ReadLine()
   
   If num1 < num2 And num1 < num3 Then
              min = num1
   ElseIf num2 < num1 And num2 < num3 Then
              min = num2
   ElseIf num3 < num1 And num3 < num2 Then
              min = num3
   
   End If
          Console.WriteLine("The minimum number is {0}", min)
          Console.ReadLine()
   End Sub
   
  End Module
  Find average of 5 numbers

   
  Module Module1
   
   Sub Main()
   
   Dim n1, n2, n3, n4, n5 As Integer
   Dim avg As Double
          Console.WriteLine("Please input first number:")
          n1 = Console.ReadLine()
   
          Console.WriteLine("Please input second number:")
          n2 = Console.ReadLine()
   
          Console.WriteLine("Please input third number:")
          n3 = Console.ReadLine()
   
          Console.WriteLine("Please input fourth number:")
          n4 = Console.ReadLine()
   
          Console.WriteLine("Please input fifth number:")
          n5 = Console.ReadLine()
   
          avg = (n1 + n2 + n3 + n4 + n5) / 5
          Console.WriteLine("The average is {0}", avg)
          Console.ReadLine()
   End Sub
  End Module
  
  Input marks and find grades

   
  Module Module1
   
   Sub Main()
   
   Dim total, s1, s2, s3, s4, s5, s6 As Integer
   Dim grade As String
   Dim percent As Double
   
          Console.WriteLine("Please input marks for each of the six subjects. Max marks=100")
   
   Do
              Console.WriteLine("For subject 1:")
              s1 = Console.ReadLine
   Loop While s1 > 100
   
   Do
              Console.WriteLine("For subject 2:")
              s2 = Console.ReadLine
   Loop While s2 > 100
   
   Do
              Console.WriteLine("For subject 3:")
              s3 = Console.ReadLine
   Loop While s3 > 100
   
   Do
              Console.WriteLine("For subject 4:")
              s4 = Console.ReadLine
   Loop While s4 > 100
   
   Do
              Console.WriteLine("For subject 5:")
              s5 = Console.ReadLine
   Loop While s5 > 100
   
   Do
              Console.WriteLine("For subject 6:")
              s6 = Console.ReadLine
   Loop While s6 > 100
   
          total = s1 + s2 + s3 + s4 + s5 + s6
          percent = (total / 600) * 100
   
   If percent >= 90 Then
              grade = "A+"
   ElseIf percent >= 80 And percent < 90 Then
              grade = "A"
   ElseIf percent >= 70 And percent < 80 Then
              grade = "B"
   ElseIf percent >= 60 And percent < 70 Then
              grade = "C"
   ElseIf percent >= 50 And percent < 60 Then
              grade = "D"
   ElseIf percent < 50 Then
              grade = "F"
   End If
   
          Console.WriteLine("Percentage = {0}%", percent)
          Console.WriteLine("The grade is {0}", grade)
          Console.ReadLine()
   
   
   End Sub
   
  End Module
   
  Determine the given number is a prime number or composite number

   
  Module Module1
   
   Sub Main()
   
   Dim i, num, flag As Integer
          Console.WriteLine("Please input your value")
          num = Console.ReadLine
          flag = 0
   
   For i = 2 To num / 2
   If num Mod i = 0 Then
                  flag = 1
   End If
   Next
   
   If flag = 0 Then
              Console.WriteLine("The number {0} is a prime number", num)
   Else
              Console.WriteLine("The number {0} is a composite number", num)
   End If
          Console.ReadLine()
   
   
   End Sub
   
  End Module
   

Attached Files
File Type: doc VB Programs by Ahmad Mushtaq.doc (46.0 KB, 233 views)
__________________
(`v)
`*..*`

.*.*) .*)
(.* (.
Bzu Forum

Don't cry because it's over, smile because it happened
Reply With Quote
Reply

Tags
ahmad, mushtaq, programs


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ahmad Mushtaq !! Salman Mushtaq Chit Chat 3 09-03-2011 12:41 AM
Factorial Program (by Ahmad Mushtaq) !!Ahmad Mushtaq!! Visual Programming 2 21-12-2009 02:14 AM
OsCommerce Presentation By Ahmad Mushtaq .BZU. E Commerce 3 05-12-2009 01:20 AM
Employee Safety by Ahmad Mushtaq : HRM Gary Dessler BSIT07-01 Human Resource Management 0 05-12-2008 09:53 AM
Introduction of Ahmad Mushtaq !!Ahmad Mushtaq!! Introduction of all Students. 3 21-09-2008 06:06 PM

Best view in Firefox
Almuslimeen.info | BZU Multan | Dedicated server hosting
Note: All trademarks and copyrights held by respective owners. We will take action against any copyright violation if it is proved to us.

All times are GMT +5. The time now is 12:52 AM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.