- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to find reminder of array multiplication divided by n
To find reminder of array multiplication divided by n, the Java code is as follows −
Example
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)); } }
Output
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.
- Related Articles
- Python Program for Find reminder of array multiplication divided by n
- C/C++ Program to Find reminder of array multiplication divided by n ?
- C/C++ Program to Find the reminder of array multiplication divided by n?
- Find reminder of array multiplication divided by n in C++
- Java program for Multiplication of Array elements.
- Find the number which when divided by 56 gives a quotient 108 and reminder 39
- C++ program for multiplication of array elements
- Java Program to Generate Multiplication Table
- Java program to find the sum of n natural numbers
- Java Program to Find Sum of N Numbers Using Recursion
- 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++
- C++ program to find perfect array of size n whose subarray is a good array
- Java Program to Find sum of Series with n-th term as n^2 – (n-1)^2
- Java program to program to cyclically rotate an array by one

Advertisements