fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. int s, a[3] = {4, 1, 3}, b[3] = {3, 5, -2};
  6.  
  7. printf("The vector a = (%d,%d,%d)\n", a[0], a[1], a[2]);
  8. printf("The vector b = (%d,%d,%d)\n", b[0], b[1], b[2]);
  9.  
  10. s = a[0]*b[0]+a[1]*b[1]+a[2]*b[2];
  11. printf("The inner product of the vectors a and b = %d\n", s);
  12.  
  13. return 0;
  14. }
Success #stdin #stdout 0.01s 5304KB
stdin
Standard input is empty
stdout
The vector a = (4,1,3)
The vector b = (3,5,-2)
The inner product of the  vectors a and b = 11