SHOW:
|
|
- or go back to the newest paste.
1 | using System; | |
2 | using System.Linq; | |
3 | using System.Text; | |
4 | ||
5 | namespace _10.ApplyBonusScore | |
6 | { | |
7 | class ApplyBonusScore | |
8 | { | |
9 | static void Main(string[] args) | |
10 | { | |
11 | bool isInteger; | |
12 | byte number; | |
13 | ||
14 | Console.WriteLine("Enter number in interval [1-9]"); | |
15 | isInteger = byte.TryParse(Console.ReadLine(), out number); | |
16 | ||
17 | if (isInteger && number > 0 && number < 10) | |
18 | { | |
19 | Console.WriteLine("Result: " + MultiplyNumber(number)); | |
20 | return; | |
21 | } | |
22 | ||
23 | Console.WriteLine("Error"); | |
24 | } | |
25 | ||
26 | private static int MultiplyNumber(byte number) | |
27 | { | |
28 | //if (number <= 3) | |
29 | //{ | |
30 | - | // return number * 10; |
30 | + | // return number * 10; |
31 | - | |
31 | + | |
32 | ||
33 | //if (number <= 6) | |
34 | //{ | |
35 | // return number * 100; | |
36 | - | // return number * 100; |
36 | + | |
37 | - | |
37 | + | |
38 | //if (number <= 9) | |
39 | //{ | |
40 | // return number * 1000; | |
41 | //} | |
42 | ||
43 | //This line does the same as the commented code in the method. | |
44 | return (int) (number * Math.Pow(10,((number -1) / 3) + 1)); | |
45 | ||
46 | //return number; | |
47 | } | |
48 | - | //return number; |
48 | + | |
49 | - | |
49 | + |