Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Only using Six Constructs 1. printf 2. scanf 3. Variables A) basic types (int, f

ID: 644493 • Letter: O

Question

Only using Six Constructs 1. printf 2. scanf 3. Variables A) basic types (int, float, double, char) B) arrays

4. We can define the Left Spiral (Figure on Left below) of a matrix and the Right Spiral (Figure on Right below) of a matrix as two special traversals of the elements of the matrix as illustrated below. Write a C program to accept an input matrix of dimension M x N called A. Now, compute two vectors from the elements in A - the first vector must include elements of A listed in order of the Left-to-Right Diagonals and the second vector must include elements of A listed in order of the Right-to-Left Diagonals. Now, compute the dot product of these two vectors and print out the scalar value.

Explanation / Answer

# include # include "nrutil.h" # include "nrutil.c" void transp(float **a,int n); float sprod(int n, float *x, float *y); int main() { int i,j; float var=0.0, sum=0.0, pro=0.0; float*b, **a; int n=3; float index; b=vector(0,n-1); a=matrix(0,n-1,0,n-1); printf(" Vector b "); for(j=0;j