CodePudding user response:
Demand is not clearIf the calculation result is
Recursion is suitable
CodePudding user response:
N (n - 1) (n - 2)... 1 + (n - 1) (n - 2)... 1 + (n - 2) (n - 3)... 1 +... + 1=what I want is this equation, how to use c # complete the output, the great god answer ah, thank you thank youCodePudding user response:
Made up of, a little complicated, so a mean
using System.Data;
using System.Windows.Forms;
The namespace Test_8
{
Public partial class Form1: Form
{
Public _click ()
{
InitializeComponent();
MessageBox. Show (" formula: "+ expression (5, 1) +" \ r "+" result: "+ new DataTable (.) Compute (expression (5, 1), null));
}
Private string expression (int _max, int _min)
{
String exp=null;
The int value=https://bbs.csdn.net/topics/_max;
While (value & gt;=_min)
{
String ls=null;
For (int I=value; I & gt;=_min; I -) {ls +=I; If (I & gt; _min) ls +="*"; }
Exp +=ls;
If (value & gt; _min) exp +="+";
The else {exp +="*" + value; }
The value -;
}
Return exp.
}
}
}
CodePudding user response:
5 x4x3x2x1 + 4 + 3 x2x1 x3x2x1 + 2 x1 + 1 x1=Why is 1 x1, feeling is 1 more reasonable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
The namespace T396195500
{
Class Program
{
The static void Main (string [] args)
{
ListList=new List
(a);
For (int I=5; I & gt;=1; I -)
{
Var l=new List(a);
For (int j=I; J & gt;=1; J -)
L.A. dd (j.t. oString ());
List. The Add (l);
}
Console. WriteLine (string. Join (" + ", the list. Select (x=& gt; String. The Join (" x ", x))) + "=");
}
}
}