Using functions, write a program that multiplies two arrays.
Use the following functions:
- Function ReadArray
- Function MultiplyArrays
- Function DisplayArrays
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 |
What is c method?
Why can’t we compare structures?
What is keyword with example?
What is ambagious result in C? explain with an example.
What is a wrapper function in c?
why should i select you?
What is include directive in c?
What is the code for 3 questions and answer check in VisualBasic.Net?
Define circular linked list.
Write a program to compute the following 1!+2!+...n!
Explain what?s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
How to declare pointer variables?