write a program when given an integer n prints out all positive number with 4 divisors up to n

write a program when given an integer n prints out all positive number with 4 divisors up to n

#include <iostream>

using namespace std;

int main()

{

int n ;
cin>>n ;

for(int i =1 ; i<=n ; i++)
{

for(int j=1 ; j<=n ; i++)

if(i%j==0)

cout<<i ;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

using namespace std;

int main()
{
    int n ;
    cin>>n ;

    for(int i =1 ; i<=n ; i++)
    {

//for(int j=1 ; j<=n ; i++)
        if(i%4==0)
        cout<<i<<" " ;
    }
}
Topic archived. No new replies allowed.