作業2.一元二次方向根を判断する場合
5859 ワード
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace ConsoleApplication1
7 {
8 class Program
9 {
10 static void Main(string[] args)
11 {
12 //
13 Console.Write(" a,b,c ");
14 string a1 = Console.ReadLine();
15 string b1 = Console.ReadLine();
16 string c1 = Console.ReadLine();
17 int a = Convert.ToInt32(a1);
18 int b = Convert.ToInt32(b1);
19 int c = Convert.ToInt32(c1);
20
21 if (a == 0)
22 {
23 Console.WriteLine(" ");
24 }
25 else
26 {
27 int d = b * b - 4 * a * c;
28 if (d < 0)
29 {
30 Console.WriteLine(" ");
31 }
32 else if (d == 0)
33 {
34 Console.WriteLine(" ");
35 }
36 else
37 {
38 Console.WriteLine(" ");
39 }
40 }
41
42 }
43 }
44 }