/ Published in: C++

Sorted by problem ID.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* Alexander DeTrano 2/1/2010 Project Euler - Problem 1 Add all the natural numbers below one thousand that are multiples of 3 or 5. */ #include <iostream> using namespace std; int main() { int x =0; int z=0; for (int i=0;i<1000;i++){ if ( i%3 == 0||i%5 == 0){ z=i + z; } } cout<<"z= " << z <<"\n"; }
Comments
