Recursion
Recursion is calling a function within the function, creating a stack of pending functions to perform the overall task. A function that calls itself.
Here’s the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScreamingRecursion
{
class Program
{
static void Main(string[] args)
{
//asking for #
Console.WriteLine("Please enter a number :))))))))))))");
// user input :D
int number = Convert.ToInt32(Console.ReadLine());
// forwarding the first numbers into the function
Fibonacci(0, 1, 1, number);
}
// making the function to do it!!!! its static bc it doesnt need to be an object yfeel
public static void Fibonacci(int a, int b, int counter, int number)
// int a is 0, the first term then b is 1, the second term. the counter starts at one and
// counts up until it reaches the number the user inputs - then the number is the inputted number
{
// writing the numbers as it goes
Console.WriteLine(a);
// so here if the counter is less than the user inputted number then it runs the fibonacci fucntion within
// itself until it isnt
// it the forwards new values through the function that require the last bit of the function
// so it creates a stack and it goes and goes until it reaches the place of the number entered
if (counter < number) Fibonacci(b, a + b, counter + 1, number);
// tosses it on the console and lets it sit there:D2
Console.ReadLine();
}
}
}
How it does????
A user inputs the # of the place sequence they wanna get to
It takes that and yells
pseudo code for the iterative
Ask for # - saVE as variable
Create a variable set to 1 for counter
1st number vavariable assigned as 0
2nd number variable sassigned as 1
Make a (while) loop that will run until the variable equals the user input #
The 1st and 2nd number vairable will be passed into this function
Prints the first variable
The do dad will take the two variables and add them
Save as 3rd number variable
1st number = 2nd number
2nd number = 3rd number
Yeah !!!!!!!!!!!!!!!!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScreamingRecursion
{
class Program
{
static void Main(string[] args)
{
//asking for #
Console.WriteLine("Please enter a number :))))))))))))");
// user input :D
int number = Convert.ToInt32(Console.ReadLine());
// forwarding the first numbers into the function
Fibonacci(0, 1, 1, number);
}
// making the function to do it!!!! its static bc it doesnt need to be an object yfeel
public static void Fibonacci(int a, int b, int counter, int number)
// int a is 0, the first term then b is 1, the second term. the counter starts at one and
// counts up until it reaches the number the user inputs - then the number is the inputted number
{
// writing the numbers as it goes
Console.WriteLine(a);
// so here if the counter is less than the user inputted number then it runs the fibonacci fucntion within
// itself until it isnt
// it the forwards new values through the function that require the last bit of the function
// so it creates a stack and it goes and goes until it reaches the place of the number entered
if (counter < number) Fibonacci(b, a + b, counter + 1, number);
// tosses it on the console and lets it sit there:D2
Console.ReadLine();
}
}
}
How it does????
A user inputs the # of the place sequence they wanna get to
It takes that and yells
pseudo code for the iterative
Ask for # - saVE as variable
Create a variable set to 1 for counter
1st number vavariable assigned as 0
2nd number variable sassigned as 1
Make a (while) loop that will run until the variable equals the user input #
The 1st and 2nd number vairable will be passed into this function
Prints the first variable
The do dad will take the two variables and add them
Save as 3rd number variable
1st number = 2nd number
2nd number = 3rd number
Yeah !!!!!!!!!!!!!!!!
Version control
What is version control and why do we use it?
Version Control Aka Revision control aka Source Controlis the task of keeping a software system consisting of many versions and configurations well organized.
It is used to avoid general chaos and to track changes. There are no overwrites of files, nothing is ever lost, the master copy is always the most up to date copy.
Version Control Aka Revision control aka Source Controlis the task of keeping a software system consisting of many versions and configurations well organized.
It is used to avoid general chaos and to track changes. There are no overwrites of files, nothing is ever lost, the master copy is always the most up to date copy.