Write a program that reads two integers from the text file integers.dat. The first integer should be considered the low number and the second integer the high number. The program should loop through all integers between the low and high values. The loop should include the low and high integers.
1. Displays the number of integers in the file
2. Displays the number of integers divisible by 5 OR 6, but not both.
3. Displays the sum of the integers from condition 2 as well as the sum of all the integers
4. Displays the largest integer and the smallest integer that satisfy condition number 2.
5. Computes the average of the largest and smallest integer
Assume the contents of integers.dat (the file is being provided for you) are as follows:
The following is a sample output: User input in red
Welcome to Wake’s Integer processing Agency
What is name of the input file? integers.dat
The number of integers between the two numbers is 101
There are 32 integers that are divisible by 5 or 6 but not both
The sum of the integers that are divisible by 5 or 6 but not both is 4800
The sum of all the integers is 15150
The largest integer divisible by 5 or 6 but not both is 200
The smallest integer divisible by 5 or 6 but not both is 100
The average of 200 and 100 is 150
1.Use two decimal point precision for the average
2.To check your code, adjust one of the integers in the file, recompile your code and run again (suggest changing the largest and smallest integers)
3.Assume that the .dat can contain any two integers. The only constraint is that the first number is ***** than the second. Only use 100 and 200 for testing.
Write a Review
Leave a reply Cancel reply
Ask Your Question
We have verified professionals who are ready to answer your question.
Save Time and Money
We choose experts who can quickly answer your question and that suit your budget.
Get Your Answer
Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.