Finding prime factors

前端 未结 12 570
北海茫月
北海茫月 2020-12-29 14:24
#include 
using namespace std;

void whosprime(long long x)
{
    bool imPrime = true;

    for(int i = 1; i <= x; i++)
    {
        for(int z =          


        
12条回答
  •  不思量自难忘°
    2020-12-29 14:57

    This is one of the easiest and simple-to-understand solutions of your question. It might not be efficient like other solutions provided above but yes for those who are the beginner like me.

    int main() {
    
    int num = 0;
    cout <<"Enter number\n";
    cin >> num;
    int fac = 2;  
    while (num > 1) {
        if (num % fac == 0) {
            cout << fac<

    }

提交回复
热议问题