C
C#13mo ago
Lilac

C# Cyclic Numbers Array Check Help

I'm doing a homework for my Programming Fundamentals subject, which requires me to enter N numbers into array A, tell if array A is cyclic? This is my progress so far:
c#
namespace _1_Dimensional_Array
{
internal class Program
{
static void Main(string[] args)
{
//formating
Console.OutputEncoding = System.Text.Encoding.Unicode;

//Request User Input
Console.Write("Enter the amount of elements of your array: "); //Determine the amount of numbers in this Array
//Process unwanted inputs
int how_much;
while (true)
{
if (int.TryParse(Console.ReadLine(), out how_much))
{
break;
}
else
{
Console.Write("Enter the amount of elements of your array: ");
}
}

// using Arrays
int[] numbers = new int[how_much]; //create an array based on the user request

// use loops

for (int i = 0; i < numbers.Length; i++)
{
//Store all answers
Console.Write($"Give me the {i} element of Array A: ");
int element_number = Convert.ToInt32(Console.ReadLine());
}



Console.ReadKey();
}
}
}
c#
namespace _1_Dimensional_Array
{
internal class Program
{
static void Main(string[] args)
{
//formating
Console.OutputEncoding = System.Text.Encoding.Unicode;

//Request User Input
Console.Write("Enter the amount of elements of your array: "); //Determine the amount of numbers in this Array
//Process unwanted inputs
int how_much;
while (true)
{
if (int.TryParse(Console.ReadLine(), out how_much))
{
break;
}
else
{
Console.Write("Enter the amount of elements of your array: ");
}
}

// using Arrays
int[] numbers = new int[how_much]; //create an array based on the user request

// use loops

for (int i = 0; i < numbers.Length; i++)
{
//Store all answers
Console.Write($"Give me the {i} element of Array A: ");
int element_number = Convert.ToInt32(Console.ReadLine());
}



Console.ReadKey();
}
}
}
7 Replies
Omnissiah
Omnissiah13mo ago
what does cyclic mean?
Lilac
LilacOP13mo ago
So this is the definition from my lecturer: Question: Enter N numbers into array A, tell if array A is cyclic? * Definition: a periodic number is a number that repeats its value at regular intervals or cycles, For example: A = (1,3,2,1,3,2,1)         ---->    A is a non-cyclic number series A = (2,5,3,2,5,3,2,5,3)   ---->    A is a cyclic series I used a translation app for this definition
Omnissiah
Omnissiah13mo ago
ok so how you plan to do this there are simpler ways and more complicated ways
Lilac
LilacOP13mo ago
can you show me a simple way? I've been struggling to understand how to do this based on the answer of chatgpt
Omnissiah
Omnissiah13mo ago
what algorithms did you think of
Lilac
LilacOP13mo ago
I can't think of anything 🤷 I still have not learned about algorithm
Omnissiah
Omnissiah13mo ago
😐 how do you recognize a sequence that repeats? like you you
Want results from more Discord servers?
Add your server