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 Zad._3
- {
- class Program
- {
- static void parzystość(int n)
- {
- if (n % 2 == 0)
- {
- Console.WriteLine(n);
- }
- if (n==0)
- {
- }
- else
- {
- if (n%2==0)
- { parzystość(n - 2); }
- else { parzystość(n - 1); }
- }
- }
- static void Main(string[] args)
- {
- int n;
- Console.WriteLine("Podaj n");
- n = Convert.ToInt32(Console.ReadLine());
- parzystość(n);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment