0% found this document useful (0 votes)
49 views1 page

Using System

The document appears to contain code for finding the minimum and maximum values in an integer array, as well as code to calculate the sum of values in an integer array. The minmax method compares the first two elements to find the initial min and max, then loops through the rest of the array updating min and max as needed. The toplama method initializes a sum variable to 0, loops through the array adding each element to the running total, and returns the final sum.

Uploaded by

Öznur Toklu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views1 page

Using System

The document appears to contain code for finding the minimum and maximum values in an integer array, as well as code to calculate the sum of values in an integer array. The minmax method compares the first two elements to find the initial min and max, then loops through the rest of the array updating min and max as needed. The toplama method initializes a sum variable to 0, loops through the array adding each element to the running total, and returns the final sum.

Uploaded by

Öznur Toklu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace ConsoleApplication1 { class Program { static void minmax(int[] a) { int max = 0; int min = 0; if (a[0] > a[1]) { max = a[0]; min = a[1]; } else if (a[1] > a[0]) { max = a[1]; min = a[0]; } for (int s = 2; s < a.Length; s++) { if (a[s] > max) max=a[s]; else if (a[s] < min) min=a[s]; } Console.WriteLine("\tMax={0}\n\tMin={1}", max, min); }

static int toplama(int[] a) { int toplam = 0; for (int k = 0; k < a.Length; k++) { toplam += a[k]; } return toplam; }

You might also like