C
C#•12mo 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
RANIOP•12mo 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 👻 🎃
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
RANIOP•12mo ago
and code work?
x0rld 👻 🎃
idk did you tried ?
Want results from more Discord servers?
Add your server