C
C#6mo ago
RANI

needed to get 100 pairs of number find all the biggest numbers output is the lowest number

output is the lowest number out of every pair biggest number
4 Replies
RANI
RANI6mo ago
using System; namespace ConsoleApp6 { class Program { static void Main(string[] args) { Console.WriteLine("Enter the first digit"); int a = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the second digit"); int b = int.Parse(Console.ReadLine()); int max = a > b ? a : b; for (int i = 0; i < 100; i++) { Console.WriteLine("Enter the first digit"); int first = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the second digit"); int sec = int.Parse(Console.ReadLine()); Console.WriteLine("GRATE, NOW NEXT PAIR"); int currentMax = first > sec ? first : sec; if (currentMax > max) { max = currentMax; } } Console.WriteLine($"The minimum value out of all the maximum values is: {max}"); } } } that is code work or nah and the int max = a>b ? a:b what os the ? between means and the a:b
x0rld
x0rld6mo ago
it's like
int max = 0;
if(a>b)
max = a;
else
max = b;
int max = 0;
if(a>b)
max = a;
else
max = b;
RANI
RANI6mo ago
and code work?
x0rld
x0rld6mo ago
idk did you tried ?