Skip to content
Snippets Groups Projects
Commit dc3d03e3 authored by KTKadyshev's avatar KTKadyshev
Browse files

Add new file

parent 965f6fb2
No related branches found
No related tags found
No related merge requests found
#include <iostream>
using namespace std;
#include <math.h>
int main()
{
int a[3][1],b[3][1];
float skalar, modulea, moduleb;
a[0][0]=2;a[1][0]=-1;a[2][0]=0;
b[0][0]=1;b[1][0]=3;b[2][0]=-1;
skalar=a[0][0]*b[0][0]+a[1][0]*b[1][0]+a[2][0]*b[2][0];
modulea=sqrt(a[0][0]*a[0][0]+a[1][0]*a[1][0]+a[2][0]*a[2][0]);
moduleb=sqrt(b[0][0]*b[0][0]+b[1][0]*b[1][0]+b[2][0]*b[2][0]);
float cosalpha =skalar/(modulea*moduleb);
cout <<"косинус между векторами a и b = " << cosalpha << endl;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment