public partial class Form1 : Form
{
int xKomp, yKomp;
double angle, magnitude;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
xKomp = Convert.ToInt16(textBoxXKomp.Text);
yKomp = Convert.ToInt16(textBoxYKomp.Text);
double sumquad = (double)(Math.Pow(xKomp, 2) + Math.Pow(yKomp, 2));
magnitude = Math.Pow(sumquad,0.5);
label1.Text = betrag.ToString();
if (xKomp != 0)
{
angle = Math.Atan2(yKomp, xKomp);
}
if (angle <0)
{
angle = angle + Math.PI;
}
so this is my coding, but for some reason when i try xKomp= 3, and yKomp = 4.. the angle should be 0.927 which is < than 0, it wont go thorugh the last part when angle<0.
having exam soon.. really appreciate your help.