Write a C# Sharp program to swap a two digit given number and check whether the given number is greater than its swap value

  • برمجة سي شارب
  • برمجة

Write a C# Sharp program to swap a two digit given number and check whether the given number is greater than its swap value

Sample Output:

Input an integer value:
Check whether the said value is greater than its swap value: True

الأجوبة

using System;
using System.Linq;
namespace exercises
{
    class Program
    {
        static void Main(string[] args)
          {
            Console.WriteLine("Input an integer value:");
            int n = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Check whether the said value is greater than its swap value: " + test(n));
        }
        public static bool test(int n)
        {
            return (int)(n / 10) >= n % 10;
        }
    }
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...