asafgb

Untitled

Mar 21st, 2015
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. static void Main(string[] args)
  2.         {
  3.             int count = 0;
  4.             int[] arr = new int[71];
  5.  
  6.             for (int i = 0; i < arr.Length; i++)
  7.             {
  8.         // כאן אתה מכניס מספרים
  9.                 arr[i]=int.Parse(Console.ReadLine());
  10.             }
  11.                
  12.         for (int i = 0; i < arr.Length; i++)
  13.             {
  14.         // כאן אתה מדפיס את המספרים
  15.                Console.WriteLine(arr[i]);
  16.             }
  17.  
  18.             for (int i = 0; i < arr.Length; i++)
  19.             {
  20.                 int num = arr[i],sum = 0;
  21.                 while (num > 0)
  22.                 {
  23.                     sum += num % 10;
  24.                     num = num / 10;
  25.                 }
  26.                 if (arr[i] % sum==0)
  27.                     count++;
  28.             }
  29.             Console.WriteLine("The number of the evarim is: " + count);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment