Професионална програма
Loading...
GapoBG avatar GapoBG 15 Точки

03. English Name of Last Digit

Допускам грешки с прехвърлянето на резултати от метод в метод, удатете ми едно рамо ?!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EngNameLastDigit
{
    public class EnglishNameOfLastDigit
    {
        private static void Main(int lastD)
        {
            lastD = FindLastDigits(lastDigs);       //тука допускам грешка с викане на резултата от по-долния метод, помогнете да го поправя


            if (lastD == 1)
            {
                Console.WriteLine("one");
            }
            else if (lastD == 2)
            {
                Console.WriteLine("two");
            }
            else if (lastD == 3)
            {
                Console.WriteLine("three");
            }
            else if (lastD == 4)
            {
                Console.WriteLine("four");
            }
            else if (lastD == 5)
            {
                Console.WriteLine("five");
            }
            else if (lastD == 6)
            {
                Console.WriteLine("six");
            }
            else if (lastD == 7)
            {
                Console.WriteLine("seven");
            }
            else if (lastD == 8)
            {
                Console.WriteLine("eight");
            }
            else if (lastD == 9)
            {
                Console.WriteLine("nine");
            }
            else if (lastD == 0)
            {
                Console.WriteLine("zero");
            }
        }

        private int FindLastDigits(int lastDigs)
        {
            int num = int.Parse(Console.ReadLine());
            return lastDigs = num % 10;
        }
    
    }
}

 

Тагове:
0
Fundamentals Module
koknq avatar koknq 22 Точки

using System;

namespace ConsoleApp7
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int lastnumber = (n) % 10;
            switch (n % 10)
            {
                case 0:
                    Console.WriteLine("zero"); break;
                case 1:
                    Console.WriteLine("one"); break;
                case 2:
                    Console.WriteLine("two"); break;
                case 3:
                    Console.WriteLine("three"); break;
                case 4:
                    Console.WriteLine("four"); break;
                case 5:
                    Console.WriteLine("five"); break;
                case 6:
                    Console.WriteLine("six"); break;
                case 7:
                    Console.WriteLine("seven"); break;
                case 8:
                    Console.WriteLine("eight"); break;
                case 9:
                    Console.WriteLine("nine"); break;
            }
        }
    }
}

0