Loading...
Submission
# When Author Problem Language CPU Memory
20871 2024-06-13 22:19:04 AHAMMED_99 Max Number C 1 ms 1512 kb Accepted
Test Cases
# CPU Memory Points
1 0 ms 1380 kb 1 Accepted
2 0 ms 1468 kb 1 Accepted
3 0 ms 1504 kb 1 Accepted
4 0 ms 1456 kb 1 Accepted
5 0 ms 1380 kb 1 Accepted
6 0 ms 1496 kb 1 Accepted
7 1 ms 1512 kb 1 Accepted
Source Code
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int t, num1, num2, num3;
  5.  
  6. // Read the number of test cases
  7. scanf("%d", &t);
  8.  
  9. while (t--) {
  10. // Read the three numbers
  11. scanf("%d %d %d", &num1, &num2, &num3);
  12.  
  13. // Find the maximum using ternary operators
  14. int max = (num1 > num2) ? ((num1 > num3) ? num1 : num3) : ((num2 > num3) ? num2 : num3);
  15.  
  16. // Output the maximum
  17. printf("%d\n", max);
  18. }
  19.  
  20. return 0;
  21. }
  22.