I am able to computer odd numbers I know how to do that but I can't get the rest of the numbers so 1-1000 show.

I have an idea about how to count which are dividable by 3:

if (n%3==0 && n<=1000),// n is the number b=b+1;//this would be the count system cout<<b<<endl;

I am not sure if that works so can someone help me?

Here is the code I have so far:

#include <iostream> #include <cmath> #include <iomanip> int divisible (int&n); int n; using namespace std; #include <stdio.h> int main() { int InputNumber = 0; int i, j, k = 0; int PreviousNumber = 0; cout<<"Input number greater than two"<<endl; cin>>InputNumber; for(PreviousNumber = 0; PreviousNumber <= InputNumber; PreviousNumber++) { if(PreviousNumber % 3 == 0 && PreviousNumber<=1000) { k++; } if(k == 0) { cout<<PreviousNumber<<" "; } k=0; } if (n%3==0 && n<=1000),// n is the number b=b+1;//this would be the count system cout<<b<<endl; return 0; }

So Can anyone help??

This post has been edited by **keeper962**: 27 March 2010 - 09:06 AM