Finding the remainder of array multiplication divided n

#include <iostream> using namespace std; int findrem(int arr[], int len, int n) { int mul = 1; for (int i = 0; i < len; i++) mul = (mul * (arr[i] % n)) % n; return mul % n; } int main() { int arr[] = { 10, 18, 45, 7, 12, 20 }; int... Continue Reading →

Sum of elements of array

#include <iostream> using namespace std; int main (){ int arr[] = {6,12,4,7,9 }; int n = 7, sum = 0; for(int i = 0; i<n ; i++){ sum+=arr[i]; } cout<<"The array sum is "<<sum; return 0; }

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started