Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class program
- {
- public static double sred(int k)
- {
- double srednoArr=0;
- int brr3=0;
- double sum3=0;
- Random rnd = new Random();
- int[] numbers = new int[k];
- for(int i=0;i<k;i++)
- {
- numbers[i] = rnd.Next(1,1000);
- if(numbers[i]>=10||numbers[i]<=100)
- {
- sum3 += numbers[i];
- brr3++;
- }
- }
- srednoArr = sum3/brr3;
- return srednoArr;
- }
- public static void Main(string[] args)
- {
- int a,b,c;
- double result;
- Console.WriteLine("Моля въведете число а: ");
- a = int.Parse(Console.ReadLine());
- Console.WriteLine("Моля въведете число b: ");
- b = int.Parse(Console.ReadLine());
- Console.WriteLine("Моля въведете число c: ");
- c = int.Parse(Console.ReadLine());
- result = sred(Math.Abs(c-b))-sred(c+a);
- Console.WriteLine("Резултатът е ");
- Console.WriteLine(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement