1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mamaluj [8]
4 years ago
7

1. Declare two dimensional double array with 3 rows and 4 columns. a) Use scanf to read the elements for this array. b) Write a

function that computes the average of the above array. c) Write a function that computes the minimum of the above array.
Computers and Technology
1 answer:
Kobotan [32]4 years ago
8 0

Answer:

Following are the program in the C Programming Language:

#include <stdio.h> //header file

float avgs(int a[3][4]){ //define function

 int s =0, c=0; //set integer type variable

 float avg=0;   //set float type variable

 //set for loops to find sum of an array

 for (int i = 0; i < 3; i++){

   for (int j = 0; j < 4; j++){

   s = s + a[i][j];

   c +=1;

   }

 }

 //find average of an array  

 avg = s / c;

 return avg;

}

int min(int a[3][4]){//define function

 int m = a[0][0];  //set integer type variable  

 //set for loop for traversing

 for (int i = 0; i < 3; i++)

 {  for (int j = 0; j < 4; j++){

     if(m > a[i][j])

       m = a[i][j];

   }

 }

 return m;

}

int main(){//define main function

 int a[3][4];//set integer type Array

 printf("Enter the elements of an array:\n");

 for (int i = 0; i < 3; i++)

  for (int j = 0; j < 4; j++)

     scanf("%d", &a[i][j]);

 printf("\n Average of an array: %f", avgs(a));

 printf("\n Smallest element of an array: %d", min(a));

 return 0;

}

Explanation:

Here, we define header file "stdio.h" for print or scan the data.

Then, we define float type function "avgs()" for find the average of an array inside it.

  • we set two integer type variable for sum and count
  • we set float type variable to store average of an array
  • we set the for loops for the sum of an array.
  • we divide sum from count to find average and return it.

Then, we define integer type function "min()" to find the minimum value of an array.

  • we set integer type variable to store array elements
  • we set the for loops for traversing the array
  • we set if statement to find minimum value of an array.
  • we return the minimum value of an array.

Then, we define integer type "main()" function to call both the functions.

  • we set integer type array variable and get input from the user in it with the help of for loops.
  • we call both the functions with message and return 0.

You might be interested in
Which of the following were input devices for early portable computers?
nordsb [41]

Answer:

Notebooks

Explanation:

The answer is Notebooks

5 0
3 years ago
Personal information in the computer can be viewed and stolen
agasfer [191]
If that’s a true or false question it’s true.
6 0
3 years ago
The frame work for storing records in database is a
andreev551 [17]
The frame work for storing records in database is a report. (b)
3 0
3 years ago
Jill is setting up a presentation and wants to use a built-in equation, such as the area of a triangle. To insert this in her pr
Alex73 [517]
The mathematical operations/symbol/formulae can be inserted into MS powerpoint using equation editor. Just follow these steps:
1)click on the Insert
2) Select Object from the list
3) Select Equation Editor from the list and the dialog box of equation editor will open up. Now, write, edit your equation in this box. When you return back to powerpoint slide, the equation will come on the current slide, you are working on.
4 0
4 years ago
Read 2 more answers
Please help me to solve this fast please <br>​
gtnhenbr [62]
I think the student success many people are into the technology today’s and it’s not really a lot of people are not
7 0
3 years ago
Other questions:
  • 1. Which markup language adds the ability to use video without requiring the user to download add-ons?
    13·1 answer
  • Which technology is the basis for XML?
    14·1 answer
  • What file may contain data written to it in case of an unexpected error or program shut-down?
    12·2 answers
  • What are the changes in ios 14.2? What are the benefits of the ios developer program? What is next for Apple? Base your answers
    14·1 answer
  • Explain why computer users should use the cloud?
    14·1 answer
  • write an algorithm that gets the price for item A plus the quantity purchased. The algorithm prints the total cost, including a
    5·1 answer
  • Hich function would be used to remove a section of text from a document?
    12·1 answer
  • 1. How do channels differ from layers?
    11·1 answer
  • Where are domain user passwords stored?
    10·1 answer
  • Which statement best describes a social impact of computing on the world?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!