Question 1: Fortran Matrix Multiplication

The purpose of this question is to introduce you to the concepts of arrays, subroutines, and functions. You have to develop three subroutines and one function. In the main program, you have to do the following things.

  1. Read K,M,N the dimensions of an array A(K,M), and array B(M,N).

  2. Read the matrices A and B (Define the size of arrays = 25). This means A and B can be a maximum of 5x5.

  3. Print with appropriate labels, the two matrices [A and B], and then print the value and position of the maximum member of each. (use SUBROUTINE for maximum member calculation).

  4. Calculate and print matrix C as the product of the matrices A and B.(use SUBROUTINE for product calculation). Do not use the Fortran system call for matrix multiplication.

  5. 5) Test the matrix C for symmetry, and print the appropriate message.( Use FUNCTION for the symmetry calculation). A matrix MAT is symmetric if MAT[i,j] = MAT[j,i] for all i's and j's.

Test your program with the following DATA :

1.   3,2,3 that is k=3, m=2, n=3
                   --------------

2. Matrix A    Matrix B
  =========    =========

   1   0       1  2  4
   2   3       0  0  0
   4   3

If you e-mail me your program with out output : -5 marks
If you e-mail me you program or your output more than once : -2 marks

Question 2: Number system converter



Question 2: Number system converter

Write a C program that converts an integer number called DATA from base BASE to decimal. The two numbers DATA and BASE have to be read from the input. First, your program must check if BASE is a valid number or not. BASE is valid if and only if it is less than 10. Then, your program has to check if the number DATA is valid within the base BASE. DATA is valid within BASE only if each of the digits of DATA is less than BASE. If both input values are ok, then your program converts the number DATA from base BASE to base 10 (i.e. decimal). Otherwise, your program must print an appropriate error message.

Example1, If you read
452 5
then your program must respond:
Invalid number Data = 452 within BASE = 5.

Example2, If you read
452 -5
then your program must respond:
Negative base Base = -5 is Invalid.

Example3, If you read
452 11
then your program must respond:
FromTo base BASE = 11 greater or equal 10 (i.e. decimal) is invalid.

Example4, If you read
452 8
then your program must respond:
Answer = ......



Instructor Code - CS208
Thu Feb 19 10:34:08 EST 1998