Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following C program creates an two-dimensional array of integers of size 40 by 50 where each cell at row index i and column index

The following C program creates an two-dimensional array of integers of size 40 by 50 where each cell at row index i and column index j stores the value of ((i+1)*(j+1)):

#include

void main(void){

int array[40][50];

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

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

array[i][j] = (i+1) * (j+1);

printf("%d", your_function(array));

}

1. Write a function that receives the 2D array as its only input parameter, traverses all cells of the array, counts the number of elements in the array that are divisible by 6 but are not divisible by 5 (e.g. 6, 18 are counted, but 30 or 60 are not counted), and finally returns the total count.

2. Can you make the function find the total count in a more efficient way? How?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

5.4 Identify external recruitment sources.

Answered: 1 week ago

Question

What is Working Capital ? Explain its types.

Answered: 1 week ago