Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xor #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Xor #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions Intro to Solidity/contracts/fibonacci.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
pragma solidity 0.4.19;


contract Fibonacci {
/* Carry out calculations to find the nth Fibonacci number */
function fibRecur(uint n) public pure returns (uint) {
pragma solidity ^0.4.24;
contract Fibbonacci {
uint a;
uint b;
uint c;
uint n;
uint i;
constructor () public{
a=0;
b=1;
i=1;
}

/* Carry out calculations to find the nth Fibonacci number */
function fibIter(uint n) public returns (uint) {

function fiboIter(uint _n) public returns(uint){
n=_n;
for(i=1; i<n; i++){
c=a+b;
a=b;
b=c;
}
return c;
}
function print()public view returns(uint) {
return c;
}
}
11 changes: 5 additions & 6 deletions Intro to Solidity/contracts/greeter.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
pragma solidity 0.4.19;

pragma solidity 0.4.24;

contract Greeter {
string private greeting;

function Greeter(string _greeter) public {
function Greeter() public {
greeting = "Hello World";
}

function greet() public view returns (string) {
function greet()public view returns (string){
return greeting ;
}
}
18 changes: 13 additions & 5 deletions Intro to Solidity/contracts/xor.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
pragma solidity 0.4.19;


contract XOR {
function xor(uint a, uint b) public pure returns (uint) {

pragma solidity 0.4.25;
contract XOR{
uint c;
function xor (uint a,uint b) public view returns(uint) {
if(a == b) {
c = 0;
return c;
}
else {
c =1;
return c;
}
}
}