answersLogoWhite

0

Simply use a for loop (i) that runs from 2 to N-1. Checking if N % i 0 then its a Prime number.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

How can I write a program to display prime numbers from 1 to 100?

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.


How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


What is the largest prime no that is stored in 8 bit pattern?

Write your own prime number program and find out.


Write a c program to find given number is prime or not?

Yes, do write, or if you're too lazy to your homework, use google.


Write a cobol program to find prime number or not?

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.


How do you write a number as a product of its prime factors?

write the number 14as a product of prime factor?


Is 3185 a prime number?

Write 3185 as a prime number


How do you write a c program to get a range from user and give a list of prime numbers?

To get all tutorials of "c programming" Reference:cprogramming-bd.com/c_page2.aspx# prime number


With a given big integer number which is the product of two prime numbers how do you find them?

First write a program to generate the prime number. After one prime number was generated, divide the big int number by the prime number. If the remainder is zero then quotient is the second prime number ( also it is important to check whether the quotient is prime number or not because sometimes you will get wrong answer). Repeat the process until you get the result.


What BASIC program can compute and display all prime numbers from 1 to 40?

PRINT 2,3,5,7,11,13,17,19,23,29,31,37


How do write 525 as a product of prime factors?

write the prime factorization of the number. simple as that.


How do you write out the prime factorization of a prime number?

The prime number is the prime factorization. For example, the prime factorization of the prime number 3 is 3. Get it?