Hello. I have to do an program that writes an scale from num 1 to num 2. I managed to do that writes out from 1 to given number. Can anyone help me do that I can insert an scale starting number?
Code:
#include <iostream>
using namespace std;
void prime_num(int);
int main(){
cout << " Enter end of the scale: ";
int num = 0;
cin >> num;
prime_num(num);
}
void prime_num( int num){
bool isPrime=true;
for ( int i = 0; i <= num; i++) {
for ( int j = 2; j <= num; j++){
if ( i!=j && i % j == 0 ){
isPrime=false;
break;
}
}
if (isPrime){
cout << i << endl;
}
isPrime=true;
}
return 0;
}
Thanks in advance