using System;
using System.Windows.Forms;

namespace _7_6
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public static int SumDigits(int n)
        {
            int sum = 0;

            while (n > 0)
            {
                sum = sum + (n % 10);
                n = n / 10;
            }

            return sum;
        }

        private void button1_Click(object sender, System.EventArgs e)
        {
            int n = Convert.ToInt32(textBox1.Text);

            MessageBox.Show(SumDigits(n).ToString());
        }
    }
}