Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] DasArray = new int[10];
- bool ell;
- for (int i = 0; i < DasArray.Length; i++)
- {
- do
- {
- Console.WriteLine("Kérem be a " + (i+1) + ". számot:");
- ell = int.TryParse(Console.ReadLine(), out DasArray[i]);
- }
- while (!ell);
- }
- if (Series(DasArray))
- {
- Console.WriteLine("A sorozat számtani volt.");
- }
- else
- {
- Console.WriteLine("A sorozat nem volt számtani.");
- }
- }
- static bool Series(int[] Input)
- {
- int Default = Input[1] - Input[0];
- for (int i = 2; i < Input.Length; i++)
- {
- if (Input[i] - Input[i-1] != Default)
- {
- return false;
- }
- }
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement