Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace Methods_Debug
- {
- class Program
- {
- static void Main(string[] args)
- {
- PrimePrint();
- }
- private static void PrimePrint()
- {
- var n = int.Parse(Console.ReadLine());
- var n1 = int.Parse(Console.ReadLine());
- //
- List<int> isP = FindPrimesInRange(n, n1);
- for (int i = 0; i < isP.Count; i++)
- {
- if (isP[i] != isP[isP.Count - 1])
- {
- Console.Write(isP[i] + ", ");
- }
- else
- {
- Console.WriteLine(isP[i]);
- }
- }
- }
- public static List<int> FindPrimesInRange(int startNum, int endNum)
- {
- List<int> nn = new List<int>();
- var isPP = false;
- for (int i = startNum; i <= endNum; i++)
- {
- isPP = Prime(i);
- if (isPP)
- {
- nn.Add(i);
- }
- }
- return nn;
- }
- public static bool Prime(long n)
- {
- if (n==0 || n==1)
- {
- return false;
- }
- for (int i = 2; i <= Math.Sqrt(n); i++)
- {
- if (n % i == 0)
- {
- return false;
- }
- }
- return true;
- }
- private static void Fibb()
- {
- var num = long.Parse(Console.ReadLine());
- var n = Fib(num);
- Console.WriteLine(n);
- }
- public static long Fib(long n)
- {
- if (n ==0)
- {
- return 1;
- }
- if (n == 1)
- {
- return 1;
- }
- if (n == 2)
- {
- return 2;
- }
- long fi = Fib(n - 1) + Fib(n - 2);
- return fi;
- }
- private static void ReversedData()
- {
- var num = Console.ReadLine();
- var newW = Reversed((num));
- double rever = Convert.ToDouble(newW);
- Console.WriteLine(rever);
- }
- public static string Reversed(string str)
- {
- string newnum ="";
- for (int i = str.Length-1; i >=0; i--)
- {
- newnum += str[i];
- }
- return newnum;
- }
- public static void EnglishName(long n)
- {
- long lastDigit = n % 10;
- var str = "";
- switch (lastDigit)
- {
- case 0: str = "zero"; break;
- case 1: str = "one"; break;
- case 2: str = "two"; break;
- case 3: str = "three"; break;
- case 4: str = "four"; break;
- case 5: str = "five"; break;
- case 6: str = "six"; break;
- case 7: str = "seven"; break;
- case 8: str = "eight"; break;
- case 9: str = "nine"; break;
- }
- Console.WriteLine(str);
- }
- private static void GetMaxx()
- {
- var a = int.Parse(Console.ReadLine());
- var b = int.Parse(Console.ReadLine());
- var c = int.Parse(Console.ReadLine());
- //
- var max = 0;
- if (GetMax(a, b) > c)
- {
- max = GetMax(a, b);
- }
- else
- {
- max = c;
- }
- Console.WriteLine(max);
- }
- public static int GetMax(int a, int b)
- {
- var greatest = 0;
- if (a>b)
- {
- greatest = a;
- }
- else
- {
- greatest = b;
- }
- return greatest;
- }
- private static void Greeting()
- {
- //Name => Greeting
- var input = Console.ReadLine();
- string prt = Hello(input);
- Console.WriteLine(prt);
- }
- public static string Hello(string h)
- {
- var hello = $"Hello, {h}!";
- return hello;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement