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 srednia
- {
- class Program
- {
- static void Main(string[] args)
- {
- double a, b, c,g;
- Console.Write("Podaj pierwsza liczbe: ");
- a = Convert.ToDouble(Console.ReadLine());
- Console.WriteLine("Podaj druga liczbe: ");
- b = Convert.ToDouble(Console.ReadLine());
- if ((c < 0) || (g < 0))
- {
- Console.WriteLine("Błędne dane");
- Console.ReadKey();
- }
- else
- {
- c = (a + b) /2;
- g = Math.Sqrt (a * b);
- Console.WriteLine("Średnia arytmetyczna wynoi: {0} ", c);
- Console.WriteLine("Srednia geometryczna wynosi: {0} ", g);
- Console.ReadKey();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement