lundi 3 octobre 2016

How can I compare a number with other numbers without writing them all out in C?

Problem: I have IF statement if (x == 180 || x == 360 || x == 540 and so on

How can I keep that list going without writing 180 + 180 * n all out?

Extra info: i want to print "doesnt exist" if sin(x * M_PI / 180) is 0. It is 0 when sin(180), sin(360) and so on.

EDIT: i've tried sin(x2 * M_PI / 180) == 0 but it doesnt work (probably because its close to 0 but not 0)

Aucun commentaire:

Enregistrer un commentaire