Return to Snippet

Revision: 40553
at February 3, 2011 15:45 by mju4t


Initial Code
/*
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";
  
}

Initial URL

                                

Initial Description
Sorted by problem ID.

Initial Title
Project Euler Problem 1

Initial Tags

                                

Initial Language
C++