-
-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathexponentiation.sol
More file actions
28 lines (22 loc) · 716 Bytes
/
exponentiation.sol
File metadata and controls
28 lines (22 loc) · 716 Bytes
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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Solidity program to demonstrate the exponentiation operation
// Creating a contract
contract Exponentiation {
// Declaring the state variables
uint16 firstNo;
uint16 secondNo;
// Defining the first function to set the value of first variable
function firstNoSet(uint16 x) public {
firstNo = x;
}
// Defining the function to set the value of the second variable
function secondNoSet(uint16 y) public {
secondNo = y;
}
// Defining the function to calculate the exponent
function Expo() public view returns (uint256) {
uint256 answer = firstNo**secondNo;
return answer;
}
}