Skip to content

Commit

Permalink
Challenge 1: Fibonacci Sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
lexara-prime-ai committed Jul 12, 2023
1 parent 6220114 commit 6be08c7
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Fibonacci/Program.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
using System;

namespace FIBONACCI
namespace FIBONACCI
{
class SEQUENCE
{
/* INITIAL VALUES */
/* INITIAL VALUES */
static int p1 = 0, p2 = 1, p3;
static void Main(string[] args)
{
Console.WriteLine("Please provide an input value: (e.g 10) ");
// READ INPUT VALUE AND CONVERT IT TO AN INTEGER
Console.WriteLine("Please provide an input value: ");
int count = Int32.Parse(Console.ReadLine());
// PRINT THE INITIAL VALUES IN THE SEQUENCE i.e 0, 1, 1
Console.Write($"{p1} {p2}");

// ITERATE UNTIL THE VALUE OF count IS NO LONGER GREATER THAN i
for (var i = 2; i < count; i++)
{
p3 = p1 + p2;
Expand Down

0 comments on commit 6be08c7

Please sign in to comment.