Write a method named isprime which takes an integer as an


A prime number is an integer that is evenly divisible only by 1 and itself. For example, the only integers that divide 7 evenly are 1 and 7, thus 7 is a prime number.

On the other hand, a number that is not prime is said to be composite. An integer n is composite if there exist integers a and b such that n = ab, with 1 < a < n, and 1 < b < n. For example, the number 24 is composite since it can be factored in the following ways: 24 = 2 X 12, 24 = 3 X 8, and 24 = 4 X 6, with other factorizations possible, including 24 = 1 X 24 (but not only this way).

Write a method named isPrime, which takes an integer as an argument and returns true if the argument is prime or false otherwise. Write a driver program with a main method that calls the isPrime method to demonstrate that it works.

Finally, modify your program so that it makes use of the isPrime method to store a list of all the prime numbers from 1 to 100 in a text file.

The list should look like the following:

2

3

5

.

.

.

97

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Write a method named isprime which takes an integer as an
Reference No:- TGS02896692

Expected delivery within 24 Hours