-
-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathsumDigit.sol
More file actions
29 lines (23 loc) · 717 Bytes
/
sumDigit.sol
File metadata and controls
29 lines (23 loc) · 717 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
29
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Solidity program to demonstrate addition
// Creating a contract
contract sumDigit {
// Declaring the state variables
uint256 firstNo;
uint256 secondNo;
// Defining the function to set the value of the first variable
function firstNoSet(uint256 x) public {
firstNo = x;
}
// Defining the function to set the value of the second variable
function secondNoSet(uint256 y) public {
secondNo = y;
}
// Defining the function to add the two variables
function add() public view returns (uint256) {
uint256 Sum = firstNo + secondNo;
// Sum of two variables
return Sum;
}
}