Vector Operations


/ Published in: C
Save to your folder(s)

Output:

Vector A:
x: 1.000000
y: 2.000000
z: 3.000000

Vector B:
x: 2.000000
y: 3.000000
z: 4.000000

Adding A and B gives the vector:
x: 3.000000
y: 5.000000
z: 7.000000

Dot product of A and B is 20.000000.

Cross product of A and B gives the vector:
x: -1.000000
y: 2.000000
z: -1.000000

Multiplying A by the scalar quantity 5.0 gives the vector:
x: 5.000000
y: 10.000000
z: 15.000000

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.