But to get you started, you'll want to use a for loop. Inside your for loop you will do some math to figure if your number is divisible by either 2 or 3, and then have a counter variable for each number that passes the requirments in that iteration of the loop.

I just basically told you exactly what to do, so if you cant figure it out, ask your instructor for more help.

#include <iostream>
using namespace std;
int main()
{
int n;
int x = 1;
cout << "enter the value for n : " << endl;
cin >> n;
if(x <= n)
{
if(n%2==0 && n%3)
{
cout << n << endl;
x++;
}
}
return 0;
}

#include <iostream>
using namespace std;
int main()
{
int n;
int x = 1;
cout << "enter the value for n : " << endl;
cin >> n;
if(x <= n)
{
if(n%2==0 && n%3)
{
cout << n << endl;
x++;
}
}
return 0;
}

#include <iostream>
using namespace std;
int main()
{
int n;
int x = 1;
cout << "enter the value for n : " << endl;
cin >> n; // n is a specified number of input
if(x <= n)
{
if(n%2==0 && n%3) // u always check n logical error, it must be x
{
cout << n << endl; // same problem here also x in place of n
x++;
}
}
return 0;
}

while(x <= n) loop up to N
{
if(x % 2 == 0 && x % 3 == 0) // it will check ur x (n >= x >= 1) if x is
{ // divisible by both 2 and 3 then it will print and increment the counter
cout << x << endl;
count++;
}
x++; //increase the value of by 1
}

while(x <= n) loop up to N
{
if(x % 2 == 0 && x % 3 == 0) // it will check ur x (n >= x >= 1) if x is
{ // divisible by both 2 and 3 then it will print and increment the counter
cout << x << endl;
count++;
}
x++; //increase the value of by 1
}

So for this program im trying to print out the max height the projectile reaches and when i run the str on the object it dosent change the value to ...

Is C similar to C# (C-sharp); or are they completely different ? I was wondering if I should begin learning C# and the transition to C will be a tad ...

Write a program that displays all numbers divisible by 3 and 4 within a range entered by user. Display five numbers per line. Numbers are separated by exactly two spaces. ...