Write a C# Sharp program to compute the sum of the three integers. If one of the values is 13 then do not count it and its right towards the sum
- برمجة سي شارب
- برمجة
- 2021-05-16
- MarwaMohammed
الأجوبة
using System;
using System.Linq;
namespace exercises
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(test(4, 5, 7));
Console.WriteLine(test(7, 4, 12));
Console.WriteLine(test(10, 13, 12));
Console.WriteLine(test(13, 12, 18));
Console.ReadLine();
}
public static int test(int x, int y, int z)
{
if (x == 13) return 0;
if (y == 13) return x;
if (z == 13) return x + y;
return x + y + z;
}
}
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
