**The Program in C# Program to find Sum of A.P. Series is given below:**

```
using System;
namespace AP_Series_Sum
{
class Program
{
static void Main(string[] args)
{
int a, d, n;
double sum;
Console.WriteLine("Hello Codeauri Family,enter the first term of the AP series: ");
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Similarly, enter the common difference of AP series: ");
d = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Then, the number of terms in the AP series: ");
n = Convert.ToInt32(Console.ReadLine());
sum = (n * (2 * a + (n - 1) * d)) / 2;
Console.WriteLine("Okay, the sum of the AP series is: " + sum);
Console.ReadLine();
}
}
}
```

## Output:

Hello Codeauri Family,enter the first term of the AP series: 1

Similarly, enter the common difference of AP series:

3

Then, the number of terms in the AP series:

2

Okay, the sum of the AP series is: 5

## Pro-Tips💡

Here are the step by step execution of above program:

- The first line
`using System;`

is a directive that tells the compiler to include the System namespace in the program, which is required to use the`Convert`

class. - The program has a class named
`Program`

that contains the`Main`

method. The`Main`

method is the entry point of the program. - In the
`Main`

method, three integer variables`a`

,`d`

, and`n`

are declared to store the first term of the AP series, the common difference, and the number of terms in the series, respectively. - The
`sum`

variable is declared as a double to store the sum of the AP series. - The
`Console.WriteLine`

method is used to prompt the user to enter the first term of the AP series, the common difference, and the number of terms in the series. - The
`Convert.ToInt32`

method is used to convert the input string to an integer and store it in the appropriate variable. - The sum of the AP series is calculated using the formula
`sum = (n * (2 * a + (n - 1) * d)) / 2`

. - The
`Console.WriteLine`

method is used to display the sum of the AP series. - The
`Console.ReadLine`

method is used to wait for the user to press the Enter key before closing the program.

**Learn C-Sharp ↗**

C-sharp covers every topic to learn about C-Sharp thoroughly.

**Learn C Programming ↗**

C-Programming covers every topic to learn about C-Sharp thoroughly.

**Learn C++ Programming↗**

**Learn C++ Programming↗**

C++ covers every topic to learn about C-Sharp thoroughly.