Hello,

Anyone that can help me write some programs? The first one needs to be a program that shows the prime numbers betweer two parameter (a,b).
Got 3 more programs to write after.
Can pay (small) if someone wants to do it for me
If you're writing the program in C, it should be pretty simple. All you need is to have a for loop that goes from the lower to the higher parameter, and checks each number to see if it is prime with another loop that goes from 2 to 1/2 of the current number to see if it is cleanly divisible by any number. Also, to save time the loop can skip even numbers. Here is the code to a c program which I just created that calculates primes from a given int to a given int. It should be really easy to rewrite the code in a different language, if you feel so inclined.

Code:
```  #include <stdio.h> #include <stdlib.h> int IsPrime(int n); int main() {    int lower, higher, i, numIsPrime;        printf("Enter the lower parameter, inclusive:");    scanf("%d", &lower);    printf("Enter the higher parameter, inclusive:");    scanf("%d", &higher);        for(i=lower; i<higher; i++) {       numIsPrime = IsPrime(i);       if(numIsPrime) {          printf("%d\n", i);       }    } } int IsPrime(int n) {    if (n == 2 || n == 3)       return 1;        if (n <= 1 || n % 2 == 0 || n % 3 == 0)       return 0;        for (int i = 5; i * i <= n; i += 6)       {          if (n % i == 0 || n % (i + 2) == 0)             return 0;       }        return 1; } ```

Hope this helps!
#Note, this code should work; it worked in a couple tests, but hasn't been tested to be foulproof. Also, I modified the IsPrime function from the C# function here: https://en.wikipedia.org/wiki/Primality_test#C#_code
I have this on my TI 84 Plus CE. It prints prime numbers between the number Start and the number End. There might be a better way to do this. I’m not that familiar with all the commands.

Input “Start “,S
Input “End “,E
For(A,S+1,E-1
0→P:For(N,2,√(A
If fPart(A/N)=0
Then:1→P:√(A→N:End
End:If P=0:Disp A:End

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» All times are UTC - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum