Advertisement
bero_0401

parse string

Aug 15th, 2024
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | Software | 0 0
  1. namespace CsharpCourse
  2. {
  3.     internal class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             Console.WriteLine("Enter your birth year");
  8.             string year = Console.ReadLine();
  9.             int intYear = int.Parse(year);
  10.             /*
  11.             double d = double.Parse(year);
  12.             float f = float.Parse(year);
  13.             uint u = uint.Parse(year);
  14.             ...
  15.             */
  16.             Console.WriteLine($"your age is { 2024 - intYear} ");
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement