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 ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- uint Stopień;
- Console.WriteLine("Podaj stopień macierzy:");
- while (true)
- {
- if (uint.TryParse(Console.ReadLine(), out Stopień) == true) break;
- Console.WriteLine("Błędna liczba, spróbuj ponownie");
- }
- double GT = 0, DT = 0.0;
- for(uint Wiersz = 1; Wiersz <= Stopień; Wiersz++)
- {
- for (uint Kolumna = 1; Kolumna <= Stopień; ++Kolumna)
- {
- Console.Write("Podaj element [" + Wiersz + ',' + Kolumna + "]=");
- if (Wiersz > Kolumna)
- {
- GT += double.Parse(Console.ReadLine());
- }
- else if (Wiersz < Kolumna)
- {
- DT += double.Parse(Console.ReadLine());
- }
- else
- {
- double.Parse(Console.ReadLine());
- }
- }
- }
- Console.WriteLine("Dolny Trójkąt: " + DT);
- Console.WriteLine("Górny Trójkąt: " + GT);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement