基于视频解说的通过C#编程实现递归算法源代码,复制可用无需更改,明白递归算法:
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace WindowsFormsApplication4{ public partial class Form1 : Form { private string str = null; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int a; if(int.TryParse(textBox1.Text,out a)) { textBox2.Text = GetArithmetic(a).ToString(); textBox3.Text = str; } else { MessageBox.Show("请输入正确的数字"); } } int GetArithmetic(int i) { str = str + i + ","; if (i |