Bài 1: Tính S(n) = 1 + 2 + 3 + ... + n
Bài 2: Tính S(n) = 1^2 + 2^2 + ... + n^2
Bài 3: Tính S(n) = 1 + ½ + 1/3 + ... + 1/n
| pragma solidity ^0.8.0; | |
| contract BitsAndPieces { | |
| // Source: https://medium.com/@imolfar/bitwise-operations-and-bit-manipulation-in-solidity-ethereum-1751f3d2e216 | |
| /* Bitwise operations / bit manipulation */ | |
| function and(bytes1 a, bytes1 b) internal returns (bytes1) { | |
| return a & b; | |
| } |
| pragma solidity ^0.4.17; | |
| contract Auction { | |
| // Data | |
| //Structure to hold details of the item | |
| struct Item { | |
| uint itemId; // id of the item | |
| uint[] itemTokens; //tokens bid in favor of the item | |
| } |
| pragma solidity >=0.7.0 <0.9.0; | |
| contract Bai001 { | |
| uint256 m_nData; | |
| function set(uint256 i_nData) public { | |
| m_nData = i_nData; | |
| } | |
| function get() public view returns (uint256) { |