Using functions, write a program that multiplies two arrays.

Use the following functions:

- Function ReadArray

- Function MultiplyArrays

- Function DisplayArrays



Using functions, write a program that multiplies two arrays. Use the following functions: - Fu..

Answer / Garima Agrawal

Here is a simple C program using three functions: ReadArray, MultiplyArrays, and DisplayArrays. The ReadArray function reads the arrays from the user, the MultiplyArrays function multiplies the elements of the arrays, and the DisplayArrays function displays the results.nn```cn#include <stdio.h>nnvoid ReadArray(int arr[], int size);nvoid MultiplyArrays(int a[], int b[], int c[], int size);nvoid DisplayArrays(int a[], int b[], int c[], int size);nnvoid main() {n int a[10], b[10], c[10], size;n printf("Enter the number of elements: ");n scanf("%d", &size);n ReadArray(a, size);n ReadArray(b, size);n MultiplyArrays(a, b, c, size);n DisplayArrays(a, b, c, size);n}nnvoid ReadArray(int arr[], int size) {n for (int i = 0; i < size; i++) {n printf("Enter element %d: ");n scanf("%d", &arr[i]);n }n}nnvoid MultiplyArrays(int a[], int b[], int c[], int size) {n for (int i = 0; i < size; i++) {n c[i] = a[i] * b[i];n }n}nnvoid DisplayArrays(int a[], int b[], int c[], int size) {n printf("Array A: ");n for (int i = 0; i < size; i++) {n printf("%d ", a[i]);n }n printf("nArray B: ");n for (int i = 0; i < size; i++) {n printf("%d ", b[i]);n }n printf("nResult Array C: ");n for (int i = 0; i < size; i++) {n printf("%d ", c[i]);n }n}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What is c method?

1 Answers  


Why can’t we compare structures?

1 Answers  


What is keyword with example?

1 Answers  


What is ambagious result in C? explain with an example.

1 Answers   Infosys,


What is a wrapper function in c?

1 Answers  


why should i select you?

21 Answers   Wipro,


What is include directive in c?

1 Answers  


What is the code for 3 questions and answer check in VisualBasic.Net?

1 Answers   Infosys,


Define circular linked list.

1 Answers  


Write a program to compute the following 1!+2!+...n!

4 Answers  


Explain what?s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?

1 Answers  


How to declare pointer variables?

1 Answers  


Categories