Cum se scrie un program C pentru a găsi produsul scalar a doi vectori .
#include <stdio.h> #include <stdlib.h> void main() { int x, r; int v1[3], v2[3]; v1 = {1, 2, 3}; v2 = {4, 5, 6}; for (x = 0, r = 0; x < 3; x ++) { r += v1[x] * v2[x]; } printf("Produsul scalar este: %d\n", r); }
Learn More :
Vector
- Given a numerical value, check if at least one of the elements of the vector is equal to the numerical value if so, say where in the negative case, say that there is no.
- C program to Given a vector (integer or real), determine what is the maximum value of element what is the position in which this element is located
- C Program Friend & Operator: Vector Example
- C Program for distance vector algorithm to find suitable path for transmission
- Read 10 real numbers using a vector and show the least of them C Program
- C Program The dot product of two vectors
Two
- Write a c program to find out H.C.F. of two numbers.
- Write a C program to find maximum or equal between two numbers ?
- ADDITION OF TWO MATRICES USING C PROGRAM
- C Program To Find Product Of Two No Using MACRO
- C Program To Swap Two Numbers Without Using Third Variable
- C Program Concatenating Two Strings Into A Third System
- C Program to concatenate two strings without using string functions
- C Program to Interchanging Two Numbers
- C Program The dot product of two vectors
- C Program to two timing functions to measure process time
- C Program to calculate sum of two m*n matrices & store the result in 3 matrix
- C Program to swap the values of two variables by using call by reference
- Find the union and intersection of two sets of integer store it in two array C Program
- Menu driven program in C to Calculate Length, Copy into Another Compare Concatenate of Two String
- C Program To Multiply Two Polynomials
- Create Two Singly Linked List Perform Differences Display It C Program
- C Program to Input Student Details into a File For Two Subjects
- Adding two polynomial functions C Program Using Structure
- Program to Add Two Polynomials Using Linked List C Program
- Menu Driven Program to Read Two Integers Find Sum, Difference and Product C Program
- Input Two Numbers and Print Greater Number C Program