Question: Input Question 7: Write a program to read an integer N (2
Input Question 7: Write a program to read an integer N (2 <= N <= 10000) from an input file named input7.txt and then outputs a. All numbers that are divisible by 3 to the output file named output7A.txt b. All primes from 2 to N to the output file named output7B.txt Requirements: + For each part a) and b), define a method called readDataFromFile() that takes into account the input filename as the parameter and returns the number N. + In part a), write a function called printNumbersToFile() that takes the output filename as the parameter and prints out all numbers which are divisible by 3 (0 excluded). + In part b), write a function called printPrimesToFile() that takes the output filename as the parameter and prints out all primes. Example:
File input7.txt 10 Output File output7A.txt 3 6 9 File output7B.txt 2 3 5 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
