Identification division.
Program-id. Prime.
Environment division.
Data division.
Working-storage section.
77 n pic 9(3).
77 q pic 9(3).
77 r pic 9(3).
77 i pic 9(3) value 1.
Procedure division.
Para-a.
Display ( 1 , 1 ) erase.
Display ( 2 , 1 ) "enter an integer:".
Accept ( 2 , 20 ) n.
If n = 1
display ( 3 , 1 ) "number is not prime"
go to stop-para.
Para-b.
Add 1 to i.
If i = n
display ( 3 , 1 ) "number is prime"
go to stop-para.
Divide n into i giving q remainder r.
If r = 0
display ( 3 , 1 ) "number is not prime"
go to stop-para.
Go to para-b.
Stop-para.
Stop run.
Chat with our AI personalities
Write a function that implements an algorithm that checks to see if a particular integer is prime (returning a boolean). Write a program that uses that function on each number from 1 to 100, and if true, displays that number.
Yes, do write, or if you're too lazy to your homework, use google.
Write 3185 as a prime number
VBnet program to find the prime numbers between 100 to 200?
You can write out this algorithm. This will then be programmed into the device to make determining prime numbers easier.