Write a C# Sharp program to get the absolute difference between n and 51. If n is greater than 51 return triple the absolute difference
- برمجة سي شارب
- برمجة
- 2021-05-16
- MarwaMohammed
الأجوبة
using System;
namespace exercises
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(test(53));
Console.WriteLine(test(30));
Console.WriteLine(test(51));
Console.ReadLine();
}
public static int test(int n)
{
const int x = 51;
if (n > x)
{
return (n - x)*3;
}
return x - n;
}
}
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
