Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace HomeWorck_8_3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random rand = new Random();
- int number = rand.Next(100);
- int sum = 0;
- if (number == 0) {
- sum = number;
- }
- else
- {
- for (int counter = 0; counter < number; counter++)
- {
- if ((counter % 3) == 0)
- {
- sum += counter;
- }
- else if ((counter % 5) == 0)
- {
- sum += counter;
- }
- }
- }
- Console.WriteLine(sum);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement