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;
- using System.Threading.Tasks;
- namespace ConsoleApp12
- {
- class Program
- {
- static void Main(string[] args)
- {
- int a, b, i, min, max, sum;
- bool ok;
- i = 1;
- b = 0;
- do { Console.WriteLine("введите кол-во эл-в ");
- ok = Int32.TryParse(Console.ReadLine(), out a);
- if (a <= 0)
- { Console.WriteLine("ошибка");
- }
- } while (!ok);
- max = b;
- min = b;
- do
- {
- do
- {
- Console.WriteLine("введите элементы {0}", i);
- ok = Int32.TryParse(Console.ReadLine(), out b);
- } while (!ok);
- if (max > b) { b=max; }
- if (min < b) { b=min; }
- i++;
- sum = (min + max);
- } while (i <= a);
- Console.WriteLine("The sum = {0}",sum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement