Location: near Govt College of Science Multan Pakistan
Posts: 9,683
Thanks: 2,337
Thanked 2,223 Times in 1,816 Posts
Contact Number: Removed
Program / Discipline: BSIT
Class Roll Number: 07-15
Time Spent Online: 3 Months 3 Weeks 5 Days 3 Hours 44 Minutes 43 Seconds
Display the Prime Numbers of an Array VB Code (By Sheraz)
Module Module1 Sub Main() Dim ar As Integer() Dim flag As Integer ar = New Integer() {15, 8, 1, 6, 34, 7, 5, 342, 4, 9} For i = 0 To ar.GetUpperBound(0) flag = 0 For j = 2 To ar(i) / 2 'Divide by 2 because of Mathematics Rule If ar(i) Mod j = 0 Then flag = 1 Exit For 'To make Program more efficien(It is ptional) End If Next If flag = 0 Then Console.WriteLine("The number {0} is Prime", ar(i)) End If Next Console.ReadLine() End Sub End Module
__________________
(¯`v´¯) `*.¸.*` ¸.*´¸.*´¨) ¸.*´¨) (¸.*´ (¸.Bzu Forum
Don't cry because it's over, smile because it happened