Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication22
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int a;
  14. int b;
  15. bool isPrime;
  16.  
  17.  
  18. Console.WriteLine("Enter a number: ");
  19. a = Convert.ToInt32(Console.ReadLine());
  20.  
  21.  
  22. Console.WriteLine("Now enter a second number: ");
  23. b = Convert.ToInt32(Console.ReadLine());
  24.  
  25. //Console.WriteLine(a + " and " + b);
  26.  
  27. if (x = 2; x < a; x++)
  28. {
  29. for (int y = 1; y < x; y++)
  30. {
  31. if (x % y == 0)
  32. {
  33. isPrime = true;
  34. }
  35. if (isPrime = false)
  36. {
  37. break;
  38. }
  39. }
  40. }
  41. if (isPrime = false)
  42. {
  43. Console.WriteLine(x);
  44. isPrime = true;
  45. }
  46.  
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement