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 Functions
- {
- class Program
- {
- static double check(double goodDiameter, int amount)
- {
- int good=0;
- for (int i = 0; i < amount; i++)
- {
- Console.WriteLine("Enter made diameter");
- double actualDiameter = double.Parse(Console.ReadLine());
- if (goodDiameter >= actualDiameter)
- if ((goodDiameter - actualDiameter) <= 1)
- good++;
- if(actualDiameter>=goodDiameter)
- if((actualDiameter-goodDiameter) <= 1)
- good++;
- }
- return good;
- }
- static void Main(string[] args)
- {
- for (int a = 0; a < 50; a++)
- {
- Console.WriteLine("Enter standard diameter:");
- double goodDiameter = double.Parse(Console.ReadLine());
- Console.WriteLine("Enter amount made:");
- int amount = int.Parse(Console.ReadLine());
- check(goodDiameter, amount);
- Console.WriteLine(check(goodDiameter, amount));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement