# Calculate values of a function - Tutorial C# Sharp

## Lesson 3:

## Basic data types

## Exercise 3.8:

## Calculate values of a function

## Objetive:

## Create a program to display certain values of the function y = x2 - 2x + 1 (using integer numbers for x, ranging from -10 to +10)

## Source Code:

```
using System;
public class DisplayFunction
{
public static void Main()
{
int y, x;
Console.WriteLine("y = x² - 2x +1");
Console.WriteLine();
for (x = -10; x <= 10; x++)
{
y = x * x - 2 * x + 1;
Console.WriteLine(
"x = {0} ; y=({0})² - 2*({0}) +1 = {1}",
x, y);
}
}
}
```

Exercisey
3.8