1. Return the Equi-side of a triangle to the same waist. 2. Other returns. 3. cannot constitute a triangle. 4.
Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Namespace sanjiaoxing
{
// Return the Equi-side of a triangle. 1 equals waist. 2. Other returns. 3. cannot constitute a triangle. 4.
Class Program
{
Static void main (string [] ARGs)
{
Int sum;
Console. writeline ("Enter the three sides of the triangle respectively ");
Int A = int. parse (console. Readline ());
Int B = int. parse (console. Readline ());
Int c = int. parse (console. Readline ());
If (! (A + B> C | A + C> B | B + C> ))
{
Console. writeline ("Three Input sides cannot form a triangle ");
Sum = 4;
}
Else
{
If (A = B & B = C)
{
Sum = 1;
Console. writeline ("the input three sides constitute an equi-edge triangle ");
}
Else if (A = B &! = C) | (A = C &! = B) | (B = C & B! = ))
{
Sum = 2;
Console. writeline ("the input three sides constitute an isosceles triangle ");
}
Else
{
Sum = 3;
Console. writeline ("the input three sides constitute a normal triangle ");
}
}
Console. writeline ("returned value is {0}", sum );
Console. Readline ();
}
}
}
2. Dog age
Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Namespace dogage
{
Class Program
{
Static void main (string [] ARGs)
{
Console. writeline ("Enter the age of the dog! ");
Int age = int. parse (console. Readline ());
Int [] arr = new int [20];
Arr [0] = 17;
Arr [1] = 23;
Arr [2] = 28;
For (INT I = 3; I <arr. length; I ++)
{
Arr [I] = arr [I-1] + 4;
}
Console. writeline ("age of a dog relative to a person: {0}", arr [age-1]);
}
}
}
3. the rules for a column are as follows: 1, 1, 2, 3, 5, 8, 13, 21, 34 ...... calculate the number of 30th digits and use a recursive algorithm.
Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Namespace diguidemo
{
// The rules for columns are as follows: 1, 1, 2, 3, 5, 8, 13, 21, 34 ...... calculate the number of 30th digits and use a recursive algorithm.
Class Program
{
Static void main (string [] ARGs)
{
Console. writeline (digui (30 ));
Console. Readline ();
}
Static int digui (int t)
{
If (T <= 0)
{
Return 0;
}
Else if (T <= 2)
{
Return 1;
}
Else
{
Return digui (t-2) + digui (t-1 );
}
}
}
}
4. How can I program a Bubble sorting algorithm? Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Namespace maopao
{
// Sort Arrays
Class Program
{
Static void main (string [] ARGs)
{
Int [] arr1 = new int [] {12, 4, 22, 5, 9, 36, 7, 14, 2, 18 };
Console. writeline ("Before sorting arrays ");
Foreach (int n in arr1)
Console. Write (n + "");
Console. writeline ();
Int J, temp;
For (INT I = 0; I <arr1.length-1; I ++)
{
J = I + 1;
AA:
If (arr1 [I]> arr1 [J])
{
Temp = arr1 [I];
Arr1 [I] = arr1 [J];
Arr1 [J] = temp;
Goto AA;
}
Else
If (j <arr1.length-1)
{
J ++;
Goto AA;
}
}
Console. writeline ("after array Bubble Sorting ");
Foreach (int n in arr1)
Console. Write (n + "");
Console. writeline ();
}
}
}