hi! help me.. Construct a c++ program that will accept the integer value. The program will get the factor of the integer..

Recommended Answers

All 2 Replies

The program will accept any integer input and determines either it is a prime or not not a prime numbers..

To find whether a number 'X' is prime:

Run a loop starting from 2 upto X/2
Inside loop check if X%iterator == 0
if yes then break from the loop and print that number is not prime.
If loop runs till the end the number is prime.

Vinayak

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.