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 _5
- {
- class Program
- {
- static int SumujParzyste(int n)
- {
- int suma = 0;
- for (int i = 0; i <= n; i++)
- {
- if (i%2==0)
- suma = suma + i;
- }
- return suma;
- }
- static void Main(string[] args)
- {
- Random r = new Random();
- int a = r.Next(1, 11);
- for (int i = 0; i < 10; i++)
- {
- a = r.Next(1, 11);
- Console.WriteLine("Zsumowowane liczby: " + SumujParzyste(a));
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement