What is the! =?

-1

What is != in C # and how can I use it properly? I visualized an example in a repeat structure with for , however I did not quite understand the function of it.

int soma = 0;
for (int i = 1; i <= 100; i++)
{
    if (i % 3 != 0)
    {
        soma += i;
    }
}
    
asked by anonymous 05.04.2018 / 20:20

1 answer

2

In C # != is a relational operator that means "other than".

Other relational operators are == , < , > , <= , >= , which means equal, less than, greater than, less than or equal and greater or equal respectively.

They are used to make conditions with the commands if , while , among others.

Some examples can be found here: link

    
05.04.2018 / 20:21