Skip to content

Instantly share code, notes, and snippets.

@renso3x
Created March 4, 2026 03:40
Show Gist options
  • Select an option

  • Save renso3x/ae6aaf7791667170536e6755eb67bed3 to your computer and use it in GitHub Desktop.

Select an option

Save renso3x/ae6aaf7791667170536e6755eb67bed3 to your computer and use it in GitHub Desktop.
Activity Three
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.31;
contract Activity_3 {
// Celsius to Fahrenheit Converter - Make a function that will convert Celsius to Fahrenheit.
function celsiusToFahrenheit(uint celsius) public pure returns (uint256) {
return (celsius * 9/5) + 32;
}
// Make a function that will convert hours to seconds.
function convertHoursToSeconds(uint256 hr) public pure returns(uint256) {
return hr * 60 * 60;
}
// Make a function that will compute the average of three numbers.
function averageOfThreeNumbers(uint256 a, uint256 b, uint256 c) public pure returns(uint256) {
return (a + b + c) / 3;
}
// Make a function that converts Eth to dollars
function convertEthToDollars(uint256 ethAmount) public pure returns(uint256) {
return ethAmount * 2000;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment