Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- double a, b, c = 0;
- do
- {
- Console.WriteLine("Введите число a");
- a = Convert.ToDouble(Console.ReadLine());
- } while (a <= 0);
- do
- {
- Console.WriteLine("Введите число b");
- b = Convert.ToDouble(Console.ReadLine());
- } while (b <= 0);
- Console.WriteLine("Введите число c");
- double needed = Convert.ToDouble(Console.ReadLine());
- c = needed;
- while (needed != 0) {
- Console.WriteLine("Введите число c");
- needed = Convert.ToDouble(Console.ReadLine());
- if (needed != 0)
- {
- a = b;
- b = c;
- c = needed;
- }
- }
- Console.WriteLine( ariphmeticProgression(a, b, c) );
- Console.ReadKey();
- }
- static bool ariphmeticProgression(double a,double b,double c)
- {
- if( b - a == c - b)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement