Eel 2161 electrical engineering computer methods assignment


Electrical Engineering Computer Methods Assignment

Q1. Write a program that given the following array, reverses all array elements and then prints them.

int x[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

Q2. Write a program to define a 1D array of 1000 element and fill it with a random values (using rand() function) between 1 and 1000 (integers), then searches and counts the number of values that can be exactly divided by 5. Finally print these values with their index numbers.

Q3. Write a program to compute the sum of two matrices and then print it. Firstly user will be asked to enter the order of matrix (number of rows and columns) and then two matrices.

For example if the user entered order as 2, 2 i.e. two rows and two columns and matrices as

First Matrix:-

1              2

3              4

Second Matrix:-

4              5

-1            5

Then output of the program (sum of First and Second matrix) will be

5              7

2              9

Q4. Write a program that will read five values from the keyboard (use a loop) and store them in an array of type float with the name amounts. Create two arrays of five elements of type long with the names dollars and cents. Store the whole number part of each value in the amounts array in the corresponding element of dollars and the fractional part of the amount as a two-digit integer in cents (e.g., 2.75 in amounts[1] would result in 2 being stored in dollars[1] and 75 being stored in cents[1]). Output the values from the two arrays of type long as monetary amounts (e.g., $2.75).

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Eel 2161 electrical engineering computer methods assignment
Reference No:- TGS01609633

Expected delivery within 24 Hours