Last active
April 17, 2022 09:32
-
-
Save Mazday21/2caedcc799a93220a21a40e99e75fb48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Random random = new Random(); | |
int number = rand.Next(1, 100); | |
int result = 0; | |
int multipleToThree = 3; | |
unt multipleToFive = 5; | |
for(int i = 0; i <= number; i++) | |
{ | |
if(i % three == 0 || i % five == 0) | |
{ | |
result += i; | |
} | |
} | |
Console.WriteLine("Сумма чисел, кратных 3 или 5, равна " + result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment