-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask 7.cs
More file actions
40 lines (26 loc) · 1.09 KB
/
task 7.cs
File metadata and controls
40 lines (26 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
namespace functions_and_methods
{
class Program
{
public static void Main()
{
int number1;
int exponent1;
Console.Write("\n\nFunction : To calculate the result of raising an interger number to another :\n");
Console.Write("----------------------------------------\n");
Console.Write("Input base number:");
number1= Convert.ToInt32(Console.ReadLine());
Console.Write("Input the exponent:");
exponent1= Convert.ToInt32(Console.ReadLine());
Console.WriteLine( "So the number {0} ^ (to the power) {1} = {2} ", number1, exponent1, PowerRaising(number1,exponent1));
}
public static int PowerRaising(int number1, int exponent1) {
int rvalue = 1;
int i;
for(i=1;i<=exponent1;i++)
rvalue = rvalue*number1;
return rvalue;
}
}
}