IHYPRESS PROGRAMMING
Tutorials and C programs with code and output for beginners
c programming
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
CMulti-Dimensional Arrays : Scalar Product
<09.02>
/* Scalar Product of Two Vectors */
#include <stdio.h> int main (void) { int scalar_product, n, k; int v1[]={2,3,1}; int v2[]={1,2,4}; scalar_product = 0; n=3; for (k=0; k<n; ++k) scalar_product = scalar_product + v1[k]*v2[k]; printf ("The scalar product is: %d.", scalar_product); return (0); }
Hergestellt in Deutschland / Made in Germany
The scalar product is: 12.
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland