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 ConsoleApplication22
- {
- class Program
- {
- static void Main(string[] args)
- {
- int a;
- int b;
- bool isPrime;
- Console.WriteLine("Enter a number: ");
- a = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Now enter a second number: ");
- b = Convert.ToInt32(Console.ReadLine());
- //Console.WriteLine(a + " and " + b);
- if (x = 2; x < a; x++)
- {
- for (int y = 1; y < x; y++)
- {
- if (x % y == 0)
- {
- isPrime = true;
- }
- if (isPrime = false)
- {
- break;
- }
- }
- }
- if (isPrime = false)
- {
- Console.WriteLine(x);
- isPrime = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement