Console application program

how to display prime numbers

Page 1 of 1

2 Replies - 12779 Views - Last Post: 04 January 2008 - 07:43 PM Rate Topic: -----

#1 beginer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 03-January 08

Console application program

Posted 03 January 2008 - 02:43 AM

as i am a beginer as of vb.net i have a assignment to generate prime number from 4-72
to check whether the entered number is armstrong or not.

:crazy:
thanx!
Is This A Good Question/Topic? 0
  • +

Replies To: Console application program

#2 beginer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 03-January 08

Re: Console application program

Posted 03 January 2008 - 03:25 AM

dim num, div as integer
sub main ()
writeline("enter the number")
num=readline()
div=2
while(div<num)
if(num mod div = 0)
writeline("num is non prime")
read()
exit sub
end if
div=div+1
end while
writeline("number is prime")
read()




i have tried this one...but this for checking whether the number is prime or not but i dont know how to generate a list.

Edit: Please use code tags when posting code, like so => :code:

This post has been edited by PsychoCoder: 04 January 2008 - 10:10 PM

Was This Post Helpful? 0
  • +
  • -

#3 ferrari12508  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3
  • View blog
  • Posts: 1,115
  • Joined: 02-November 07

Re: Console application program

Posted 04 January 2008 - 07:43 PM

well you could use a label from the toolbox and just have
label1.text = Num.tostring


just put that at the end of your code once it has gotten whether it is prime or not. If you want to generate a list, than do :
label1.text = label1.text & ControlChars.NewLine & Num.tostring


This post has been edited by ferrari12508: 04 January 2008 - 07:45 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1