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.RegularExpressions;
- namespace Rextester
- {
- class S {
- int []m = new int[5];
- int max;
- int min;
- public int this [int i]{
- set { m[i] = value; }
- get { return m[i]; }
- }
- public int Max{
- get { return max; }
- }
- public int Min{
- get { return min; }
- }
- public void maxMin() {
- max = min = m[0];
- foreach (int i in m) {
- if (max < i) max = i;
- if (min > i) min = i;
- }
- }
- }
- public class Program
- {
- public static void Main(string[] args)
- {
- S s = new S();
- for (int i = 0; i < 5; i++) {
- s[i] = Convert.ToInt32(Console.ReadLine());
- }
- for (int i = 0; i < 5; i++) {
- Console.Write(s[i]+" ");
- }
- s.maxMin();
- Console.Write("\nmax = {0}\nmin = {1}", s.Max, s.Min);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement