- Related Questions & Answers
- Python Program for Find reminder of array multiplication divided by n
- C/C++ Program to Find reminder of array multiplication divided by n ?
- Find reminder of array multiplication divided by n in C++
- C/C++ Program to Find the reminder of array multiplication divided by n?
- Java program for Multiplication of Array elements.
- C++ program for multiplication of array elements
- Program to find remainder when large number is divided by 11 in C++
- Program to find remainder when large number is divided by r in C++
- Addition multiplication ladder in an array in JavaScript\n
- Java program to find the sum of n natural numbers
- C program to print multiplication table by using for Loop
- C program to find type of array entered by the user.
- Can array be divided into n partitions with equal sums in JavaScript
- 8086 program to find average of n numbers
- Python program multiplication of two matrix.

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

To find reminder of array multiplication divided by n, the Java code is as follows −

import java.util.*; import java.lang.*; public class Demo{ public static int remainder(int my_arr[], int arr_len, int val){ int mul_val = 1; for (int i = 0; i < arr_len; i++) mul_val = (mul_val * (my_arr[i] % val)) % val; return mul_val % val; } public static void main(String argc[]){ int[] my_arr = new int []{ 35, 100, 69, 99, 27, 88, 12, 25 }; int arr_len = 8; int val = 11; System.out.println("The remainder when the array is multiplied by 11 is "); System.out.println(remainder(my_arr, arr_len, val)); } }

The remainder when the array is multiplied by 11 is 0

A class named Demo contains a static function named ‘remainder’, that iterates through an integer array, and checks to see if a specific number divides all the elements of the integer array completely, otherwise give the reminder values. In the main function, the value for the number is defined, an integer array is defined, and the length of the array is defined. The function is called by passing the integer arrat, length of array, and number as parameters. Relevant message is displayed on the console.

Advertisements