0% found this document useful (0 votes)
99 views7 pages

Sal College of Engineering Lab Manual Blockchain Information Technology B.E. 7Th Semester JUNE 2021 - DEC 2021

This document contains details of blockchain practicals completed by a student named Patel Nayan Rajeshbhai. It includes 4 practical assignments: 1) A Solidity program to add two integers, 2) Storing a value using a constructor, 3) Demonstrating variable scope in Solidity, 4) A program to print a string value. For each practical, the input Solidity code and output are documented.

Uploaded by

Nayan Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views7 pages

Sal College of Engineering Lab Manual Blockchain Information Technology B.E. 7Th Semester JUNE 2021 - DEC 2021

This document contains details of blockchain practicals completed by a student named Patel Nayan Rajeshbhai. It includes 4 practical assignments: 1) A Solidity program to add two integers, 2) Storing a value using a constructor, 3) Demonstrating variable scope in Solidity, 4) A program to print a string value. For each practical, the input Solidity code and output are documented.

Uploaded by

Nayan Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

181130116075

Blockchain Practicals. Patel Nayan R.


SAL COLLEGE OF ENGINEERING

LAB MANUAL

BLOCKCHAIN
INFORMATION TECHNOLOGY

B.E. 7th SEMESTER


JUNE 2021 – DEC 2021

Name: Patel Nayan Rajeshbhai

Roll No: 181130116075






181130116075 Blockchain Practicals. Patel Nayan R.

PRACTICAL-1
AIM: Write a solidity program for summation of any two integer
variable.
INPUT:


pragma solidity ^0.5.0;
contract SolidityTest {
constructor() public{
}
function getResult() public view returns(uint){
uint a = 1;
uint b = 2;
uint result = a + b;
return result;
}
}


OUTPUT:



181130116075 Blockchain Practicals. Patel Nayan R.

PRACTICAL 2:
AIM: Write a solidity program for store value using constructor.
INPUT:


pragma solidity ^0.5.0;
contract SolidityTest {
uint storedData;
constructor() public {
storedData = 20;
}
function getResult() public view returns(uint){
uint a = 5;
uint b = 5;
uint result = a + b;
return storedData;
}
}


OUTPUT:





181130116075 Blockchain Practicals. Patel Nayan R.

PRACTICAL 3:
AIM: Write Solidity Program for variable scope.
INPUT:


pragma solidity ^0.5.0;
contract C {
uint public data = 30;
uint internal iData= 10;

function x() public returns (uint) {
data = 3; // internal access
return data;
}
}
contract Caller {
C c = new C();
function f() public view returns (uint) {
return c.data(); //external access
}
}
contract D is C {
function y() public returns (uint) {
iData = 3; // internal access
return iData;
}
function getResult() public view returns(uint){
uint a = 11; // local variable
uint b = 22;
uint result = a + b;
return result; //access the state variable
}
181130116075 Blockchain Practicals. Patel Nayan R.

}


OUTPUT:































181130116075 Blockchain Practicals. Patel Nayan R.

PRACTICAL 4:
AIM: Write Solidity program for print string value.
INPUT:


pragma solidity ^0.5.0;

contract Test {
string name;


function set(string memory n) public {
name=n;
}

function get() public view returns (string memory) {
return name;
}
}


OUTPUT:
181130116075 Blockchain Practicals. Patel Nayan R.

You might also like