Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int suma1 = 0, suma2 = 0, sumaKolejnych1 = 0, sumaKolejnych2 = 0, liczbaElementow1 = 0, liczbaElementow2 = 0;
- double srednia1, srednia2, sredniaKolejnych1, sredniaKolejnych2;
- Console.Write("Podaj liczbę do tablicy 1: ");
- int podanaLiczba1 = Convert.ToInt32(Console.ReadLine());
- for (int i = 0; i < 5; i ++)
- {
- tab1[i] = podanaLiczba1;
- Console.Write(tab1[i].ToString()+" ");
- }
- for (int i = 0; i < 5; i++)
- {
- suma1 += tab1[i];
- liczbaElementow1 += 1;
- }
- srednia1 = suma1 / liczbaElementow1;
- Console.WriteLine();
- Console.WriteLine("Suma 1: "+suma1.ToString()+"\nSrednia 1: "+srednia1.ToString());
- Console.Write("Podaj liczbę do tablicy 2: ");
- int podanaLiczba2 = Convert.ToInt32(Console.ReadLine());
- for (int i = 0; i < 5; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- tab2[i, j] = podanaLiczba2;
- Console.Write(tab2[i, j].ToString() + " ");
- }
- Console.WriteLine();
- }
- for (int i = 0; i < 5; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- suma2 += tab2[i, j];
- liczbaElementow2 += 1;
- }
- }
- srednia2 = suma2 / liczbaElementow2;
- Console.WriteLine();
- Console.WriteLine("Suma 2: " + suma2.ToString() + "\nSrednia 2: " + srednia2.ToString());
- Console.Write("Podaj liczbę do tablicy 1: ");
- int kolejneLiczby1 = Convert.ToInt32(Console.ReadLine());
- for (int i = 0; i < 5; i++, kolejneLiczby1++)
- {
- tab1[i] = kolejneLiczby1;
- Console.Write(tab1[i].ToString() + " ");
- }
- liczbaElementow1 = 0;
- for (int i = 0; i < 5; i++)
- {
- sumaKolejnych1 += tab1[i];
- liczbaElementow1 += 1;
- }
- sredniaKolejnych1 = sumaKolejnych1 / liczbaElementow1;
- Console.WriteLine();
- Console.WriteLine("Suma 1: " + sumaKolejnych1.ToString() + "\nSrednia 1: " + sredniaKolejnych1.ToString());
- Console.Write("Podaj liczbę do tablicy 2: ");
- int kolejneLiczby2 = Convert.ToInt32(Console.ReadLine());
- for (int i = 0; i < 5; i++)
- {
- for (int j = 0; j < 5; j++, kolejneLiczby2++)
- {
- tab2[i, j] = kolejneLiczby2;
- Console.Write(tab2[i, j].ToString() + " ");
- }
- Console.WriteLine();
- }
- liczbaElementow2 = 0;
- for (int i = 0; i < 5; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- sumaKolejnych2 += tab2[i, j];
- liczbaElementow2 += 1;
- }
- }
- sredniaKolejnych2 = sumaKolejnych2 / liczbaElementow2;
- Console.WriteLine();
- Console.WriteLine("Suma 2: " + sumaKolejnych2.ToString() + "\nSrednia 2: " + sredniaKolejnych2.ToString());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement