PROGRAM PRIMES
This program displays a list of prime numbers. The user is prompted to enter a vslue that represents the largest prime number.PROGRAM:PRIMESNotes::ClrHome
:Disp "LAST PRIME"
:Input V
:1->dim(L6)
:2->L6(1)
:Disp 2
:For(N,3,V,2)
:1->P
:1->I
:While P and (I<=dim(L6))
:1–(N/L6(I))=int(N/L6(I))->P
:1+I->I
:End
:If P
:Then
:Disp N
:N->L6(dim(L6)+1)
:End
:End
- This program fills a list with the prime values it finds.
- It makes use of a BOOLEAN operator (True or False) for the loop control.