Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8. class Program
  9. {
  10.  
  11. static bool Equal(int[] a, int num)
  12. {
  13. bool flag;
  14. int counter=0;
  15. for (int i = 0; i < a.Length; i++)
  16. {
  17. if (num == a[i])
  18. counter++;
  19. }
  20. if (counter > 0)
  21. {
  22. flag = true;
  23. return flag;
  24. }
  25. if (counter == 0)
  26. {
  27. flag = false;
  28. return flag;
  29.  
  30. }
  31. static void Main(string[] args)
  32. {
  33. int[] a = new int[6];
  34. for (int i = 0; i < 6; i++)
  35. {
  36. Console.WriteLine("insert number");
  37. a[i] = int.Parse(Console.ReadLine());
  38. }
  39. Console.WriteLine("insert number");
  40. int num=int.Parse(Console.ReadLine());
  41. bool eqalp = Equal(a,num);
  42. if (eqalp)
  43. Console.WriteLine("good");
  44. if(eqalp==false)
  45. Console.WriteLine("bad");
  46.  
  47.  
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement