Professional Documents
Culture Documents
Blockchain Assignment of Shahbaz Khan
Blockchain Assignment of Shahbaz Khan
Assignment -1
Name- Shahbaz Khan
Roll No – 01UG19020042
Problem Statement 1:
Write a solidity contract program to show your name.
Solution Statement:
To store our name value we create a string variable named name in public
scope.
Program:
pragma solidity ^0.8.3;
contract Shahbaz {
string public name = "Shahbaz khan!";
}
Compile output:
Deploy Output:
Problem Statement 2:
Writhe solidity contract program to show the following:
Title, First Name, Middle Name, Last Name.
Solution Statement:
We create a struct of candidate which will store their data accordingly.
Assignment Number: 04
Problem Statement:
Write a Solidity contract program to add two numbers and display result:
Program:
pragma solidity ^0.8.3;
contract addTwoNumber{
function getResult()public{
result = iNum1+iNum2;
Output Compile:
Output Deploy:
Problem Statement:
WASC for bank to deposit and withdraw.
Program:
pragma solidity ^0.8.3;
contract Bank {
balanceOf[msg.sender] -= amount;
payable(msg.sender).transfer(amount);
Output Compile:
Output Deploy:
Output Test Run: