Menu
Coddy logo textTech

20. Check Prime Factors

Lesson 21 of 31 in Coddy's 30 Days of Logic Building in C++ course.

challenge icon

Challenge

Medium

Write a function to find the prime factors of a given number.

  • Input: 24
  • Output: [2,2,2,3] (factors which are prime numbers)

Try it yourself

#include <vector>
using namespace std;

vector<int> calculateCompoundInterest(int num) {
    // Write code here
}

All lessons in 30 Days of Logic Building in C++