高手们,拜托帮我用JAVE或者C编出以下程序,谢谢啦

来源:百度知道 编辑:UC知道 时间:2024/06/01 00:56:23
Prompt the user to enter 2 integers. Print all numbers in between this range (inclusive of the 2 integers entered by the user)that are divisible by 2, by 3, and by 5 in 3 separate files respectively. All others, print in a separate file.
At the end, display how many numbers in total of each were found in each file. Continue the process until the user quits the program.

提示用户输入2整数。打印所有号码之间这个范围内(其中包括2整数)的整除2 , 3 ,和5,分别显示在3个单独的文件中。其他的打印在另外一个单独的文件。
最后,显示每个文件中有多少个数。继续这一进程,直到用户退出该程序。

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class Test {

public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
int[] array = new int[2];
FileWriter writer2 = new FileWriter(new File("2.txt"));
FileWriter writer3 = new FileWriter(new File("3.txt"));
FileWriter writer5 = new FileWriter(new File("5.txt"));
FileWriter writer0 = new FileWriter(new File("others.txt"));
int count2, count3, count5, count0;
boolean flag = false;
while (true) {
if (getNumbers(array, scanner) == false) {
break;
}
int first = Math.min(array[0], array[1]);
int second = Math.max(array[0], array[1]);
writer2.append("Numbers that are exactly divisible by 2 between "
+ first + " and " +