Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 2.1 Go Evenly General Statement: Widgets are always packed in evenly dis

ID: 3636499 • Letter: P

Question

Problem 2.1 Go Evenly


General Statement: Widgets are always packed in evenly distributed amounts. Read a value N followed by 10 numbers. Determine how many of the 10 numbers will divide N evenly (without remainder).

Input: The first line in the data file is an integer that represents the number of data sets to follow. Each data set will contain 11 numbers. The first number is the number to divide. The ten numbers that follow will be used to divide the first number.


Name of Data File : pr21.dat
Name of Program : pr21.java
Name of Class File : pr21.class

Output: Output how many of the 10 numbers divide evenly into the first number.

Assumptions: Dividing by zero is a very bad thing.


Sample Input :
3
20 1 2 3 4 5 6 7 8 9 10
33 1 3 5 7 9 11 13 15 17 19
10 3 3 3 3 3 3 3 3 3 3

Sample Output:
5 of the numbers go evenly into 20.
3 of the numbers go evenly into 33.
0 of the numbers go evenly into 10.

Explanation / Answer

import java.io.*; class widget { public static void main(String[] args) { int[] a = new int[11]; int input; int sum=0; System.out.println("ENTER THE NO OF ROWS"); Scanner input = new Scanner(System.in); System.out.print(" Enter 11 positive numbers to be followed by first number: "); for (int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote