1
0

sample.csharp.txt 622 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * C# Program to Display All the Prime Numbers Between 1 to 100
  3. */
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. namespace VS
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. bool isPrime = true;
  15. Console.WriteLine("Prime Numbers : ");
  16. for (int i = 2; i <= 100; i++)
  17. {
  18. for (int j = 2; j <= 100; j++)
  19. {
  20. if (i != j && i % j == 0)
  21. {
  22. isPrime = false;
  23. break;
  24. }
  25. }
  26. if (isPrime)
  27. {
  28. Console.Write("\t" +i);
  29. }
  30. isPrime = true;
  31. }
  32. Console.ReadKey();
  33. }
  34. }
  35. }