public class Test { public static void Main() { int a, an; int p=1; Console.Write("a = "); a = int.Parse(Console.ReadLine()); Console.Write("a = "); an = int.Parse(Console.ReadLine()); while (an != 0){ p = p*(an-a); a = an; Console.Write("a = "); an = int.Parse(Console.ReadLine()); } Console.Write("p = "+p); } }
using System;
public class Test
{
public static void Main()
{
int a, an;
int p=1;
Console.Write("a = ");
a = int.Parse(Console.ReadLine());
Console.Write("a = ");
an = int.Parse(Console.ReadLine());
while (an != 0){
p = p*(an-a);
a = an;
Console.Write("a = ");
an = int.Parse(Console.ReadLine());
}
Console.Write("p = "+p);
}
}
Пример:
a = 2
a = 5
a = 8
a = 4
a = 0
p = -36