Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 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 _2_6
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int a,b;
  14. int n;
  15. int max=0;
  16. int maxzn=0;
  17. a = int.Parse(Console.ReadLine());
  18. b = int.Parse(Console.ReadLine());
  19. for(int i=a;i<=b;i++)
  20. {
  21. Console.Write("{0}, c.d=",i);
  22. n=0;
  23. for(int j=2;j<=i/2;j++)
  24. {
  25. if(i%j==0)
  26. {
  27. n++;
  28.  
  29. }
  30.  
  31. if(n>max)
  32. {
  33. max=n;
  34. maxzn=i;
  35. }
  36.  
  37.  
  38. }
  39. Console.WriteLine(n+2);
  40.  
  41. }
  42. Console.WriteLine("{0}, c.d max={1}",maxzn,max+2);
  43. }
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement