Advertisement
Spocoman

03. Passed or Failed

Jan 10th, 2022
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PassedOrFailed
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double score = double.Parse(Console.ReadLine());
  10.  
  11.             if (score >= 3)
  12.             {
  13.                 Console.WriteLine("Passed!");
  14.             }
  15.             else
  16.             {
  17.                 Console.WriteLine("Failed!");
  18.             }
  19.         }
  20.     }
  21. }
  22.  
  23.  
  24. With ternary operatop:
  25.  
  26. using System;
  27.  
  28. namespace PassedOrFailed
  29. {
  30.     class Program
  31.     {
  32.         static void Main(string[] args)
  33.         {
  34.             double score = double.Parse(Console.ReadLine());
  35.             Console.WriteLine(score >= 3 ? "Passed!" : "Failed!");
  36.         }
  37.     }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement