Java Code:
import java.util.*;
class Main {
public static void main(String[] args) {
int t;
Scanner sc=new Scanner(System.in);
t=sc.nextInt();
int a[]=new int[t];
for(int i=0;i<t;i++){
int n;
n=sc.nextInt();
int arr1[]=new int[n];
int arr2[] = new int[n],sum=0;
for(int j=0;j<n;j++)
arr1[j]=sc.nextInt();
for(int j=0;j<n;j++)
arr2[j]=sc.nextInt();
for(int j=0;j<n;j++)
sum+=arr1[j]*arr2[j];
a[i]=sum;
}
for(int i=0;i<t;i++)
System.out.println("Case #"+(i+1)+": "+a[i]);
}
}
if you like the answer please provide a thumbs up
Java code INNER PRODUCT 4E Input Standard input Output Standard output Topic Array & Array Processing!...
Java code
ABOVE AVERAGE 40 Input Standard input Output Standard output Topic Array & Array Processing Problem Description Understanding how to interpret test scores is a valuable skill for every teacher. That's because test score interpretation enables teachers to understand how their students' performance for each tests of the course. Average test score is one of the indicators to determine the class performance for the test. For each test, we need to calculate the average score and determine the percentage...
Java code
COCONUT KELAPA4 4A. Input Standard input Output Standard output Topic Array & Array Processing Problem Description Ali Wali owns a coconut plantation and a number of monkeys for bringing down coconuts. Every day, Ali would record the number of coconuts brought down by his monkeys. At the end of a certain time period, he would determine from the data recorded, the lowest and the highest number of coconuts as well as their number of occurrences. Write a program...
Java code
BIRTHDAY GRAPH5 4B Input Standard input Output Standard output Topic Array & Array Processing Birthday Graph Problem Description Everyone loves to be celebrated on their birthdays. Birthday celebration can encourage positive social E interaction among co-workers, foster friendship among classmates or even strengthen bond between E BOBO Birthday graph can be display in many forms. It can a creative drawing consists of cupcakes, balloons, UU candles with names, or it can be in the form of simple bar...
Given an array A[] of integers find sum of product of all pairs of array elements Input: First line consists of T test cases. First line of every test case consists of N, denoting number of elements of array. Second line consists of elements of array. Output: Single line output, print the sum of products. Constraints: 1<=T<=100 1<=N<=100 Solve the problem using pointers and (if possible) using operators Example: Input: 2 3 1 3 4 4 2 3 4 5...
In Java write the following array- processing methods into the same application, Lab13.java. Use the main method in this application to test your methods. 1) Write the void method, shiftLeft, which accepts an array of int and changes the elements of this array so that the index of each element is now less by one and the last element of the array is now zero. For example, if the parameter array is {7, 3, 2, 9, 5}, then when this...
Use C programming Swap two arrays using pointers Given two integer arrays, swap the two arrays using pointers. Input: 4 1 2 3 4 5 4 5 6 7 8 where: First line represents the number of elements in the first array. Second line represents the elements in the first array. Third line represents the number of elements in the second array. Fourth line represents the elements in the second array. Output: 4 5 6 7...
IN JAVA please Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. Your code will be tested for runtime. Code which does not output a result in logarithmic time (making roughly log(2) N comparisons) will fail the tests. A sample main function is provided so that you may test your code on sample inputs. For testing purposes, the...
C Programming Language
The code below matches the sample input/output but is marked
wrong. Are there other ways to do this problem? The focus is on
recursion and functions.
#include<stdio.h>
int joCheck(unsigned long long int number)
{
if(number % 7 == 0 || number % 8 == 0)
{
return 1;
}
else return 0;
}
int main()
{
int cases = 0;
scanf("%d", &cases);
for(int i = 1; i<=cases; i++)
{
unsigned long long int number;
scanf("%d", &number);
if(joCheck(number)...
java
estion7 For this question, assume all input comes from the keyboard, and al output goes to the screen. Include method prototypes and comments. The array should have room for 100 integers Write a complete Java program, including at least one comment in the main propram and one in e to do the following: Write a main program which will call the methods described below (a) First the main program will read an integer (this integer is a parameter or...
C++ 3. Random modification of all elements in an integer array. a) Initialize an integer array of capacity 5. b) Implement an array output function. c) Output the array to console. d) Implement an offset function that accepts an integer array as input and randomly modifies each element by +/- 5. e) Use the offset function to update the array. f) Output the modified array. Example Output (input in bold) Original: 5 1 4 9 2 Offset: 7 -2 6...