mardi 1 octobre 2019

How do I list all the co prime numbers of a given integer in C++? Without using hcf/gcd

I have a homework problem. Our teacher wants us to gather an integer input greater than 1 from the user and then list out all of the COPRIME factors of the integer. We CAN'T use any of the hcd/gcf functions, we haven't learned any of those Lehmir's algorithims or whatever else. The only thing we can use are for and/or while loops and if statements. We can't use the void main either.

The only thing I have right now are the cout statements asking the user for the number lol. Not sure where to use an while or a for loop

So the output should come out something like:

Number: 8 ..... Co-prime: 3, 5 and 7

Aucun commentaire:

Enregistrer un commentaire