daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest May 17th, 2018 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int Min_Positive, Max_Negative = 0, Current_Num, Numbers=0;
  13.             do
  14.             {
  15.             Console.Write("Enter The "+ (Numbers+1)+" Number: ");
  16.             Current_Num=int.Parse(Console.ReadLine());
  17.             if(Current_Num<0 && Current_Num<Max_Negative) //IF NEGATIVE AND CURRENTLY THE BIGGEST NEGATIVE
  18.                 Max_Negative=Current_Num;
  19.             Numbers++;
  20.             }
  21.             while(Current_Num < 0 && Numbers < 10 );
  22.             if(Numbers == 10)
  23.             {
  24.                 Min_Positive=0; //THERE WERE NO POSITIVE NUMBERS ENTERED
  25.                 Console.WriteLine("There were no positive numbers in your input");
  26.                 Console.WriteLine("Maximum negative number is: "+ Max_Negative);
  27.             }
  28.             else
  29.             {
  30.                 Min_Positive=Current_Num;
  31.                 for (int i = Numbers; i < 10; i++) //CONTINUE ASKING FOR INPUT
  32.                 {
  33.                     Console.Write("Enter The " + (i + 1) + " Number: ");
  34.                     Current_Num=int.Parse(Console.ReadLine());
  35.                     if(Current_Num > 0 && Current_Num < Min_Positive) //IF POSITIVE AND IT IS THE CURRENT MINIMUM
  36.                         Min_Positive = Current_Num;
  37.                     if (Current_Num < 0 && Current_Num > Max_Negative) ////IF NEGATIVE AND IT IS THE MAXIMUM NEGATIVE
  38.                         Max_Negative = Current_Num;
  39.                 }
  40.                 Console.WriteLine("Minimum positive number: " + Min_Positive);
  41.                 if(Max_Negative==0)
  42.                     Console.WriteLine("There were no negative numbers in your input");
  43.                 else
  44.                 Console.WriteLine("Maximum negative number is: " + Max_Negative);
  45.             }
  46.         }
  47.     }
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top