Advertisement
vencinachev

Methods-void

Mar 6th, 2022
918
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.43 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ITC1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.Write("Enter number: ");
  14.             int n = int.Parse(Console.ReadLine());
  15.             Console.Write($"Last digit name of {n} is: ");
  16.             LastDigitName(n);
  17.             PresentMe("Ivan", 20);
  18.         }
  19.  
  20.         static void LastDigitName(int number)
  21.         {
  22.             //int lastDigit = number % 10;
  23.             switch (number % 10)
  24.             {
  25.                 case 0: Console.WriteLine("zero"); break;
  26.                 case 1: Console.WriteLine("one"); break;
  27.                 case 2: Console.WriteLine("two"); break;
  28.                 case 3: Console.WriteLine("three"); break;
  29.                 case 4: Console.WriteLine("four"); break;
  30.                 case 5: Console.WriteLine("five"); break;
  31.                 case 6: Console.WriteLine("six"); break;
  32.                 case 7: Console.WriteLine("seven"); break;
  33.                 case 8: Console.WriteLine("eight"); break;
  34.                 case 9: Console.WriteLine("nine"); break;
  35.             }
  36.         }
  37.  
  38.         static void PresentMe(string name, int age)
  39.         {
  40.             Console.WriteLine($"My name is {name}!");
  41.             Console.WriteLine($"I am {age} years old!");
  42.             Console.WriteLine("Bye bye");
  43.         }
  44.     }
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement