창고/Backup_2013_0121 Q1 가능성1g 2012. 2. 25. 18:24 반응형 C# using System; using System.Collections.Generic; using System.Text; namespace EulerProject { class Program { static void question1() { /* 1000 미만의 자연수 중 3이나 5의 배수를 모두 더하라. */ int result = 0; for (int i = 1; i < 1000; i++) { if (i % 3 == 0 || i % 5 == 0 ) result += i; } Console.WriteLine("Q1: {0}", result); } static void Main(string[] args) { question1(); } } } 천리길도 한걸음 부터 -ㅁ-ㅋㅋ 반응형 저작자표시 비영리 동일조건 (새창열림)