SHARE
TWEET

Untitled

a guest Oct 19th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. amespace son1
  2. {
  3.     /// <summary>
  4.     /// Interaction logic for MainWindow.xaml
  5.     /// </summary>
  6.     public partial class MainWindow : Window
  7.     {
  8.         public MainWindow()
  9.         {
  10.             InitializeComponent();
  11.         }
  12.  
  13.         private static int[] trio(int n)
  14.         {
  15.             int[] a = new int[3];
  16.             a[1] = n / 3;
  17.             a[0] = a[1] - 1;
  18.             a[2] = a[1] + 1;
  19.             if(n%3==1) {a[2]++;}
  20.             if (n % 3 == 2)
  21.             {
  22.                 a[1]++;
  23.                 a[2]+=2;
  24.             }
  25.             return a;
  26.         }
  27.  
  28.         private void go_Click(object sender, RoutedEventArgs e)
  29.         {
  30.             int d = Convert.ToInt32(dan.Text);
  31.             int[] a = trio(d);
  32.             otv.Content = String.Concat("Младнему сыну досталось ", a[0], \r\n", "Среднему сыну досталось ", a[1], \r\n", "Старшему сыну досталось ", a[2], "м");
  33.         }
  34.     }
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top