Name: Anonymous 2010-03-19 1:28
Write a program that behaves as follows: a first integer value is input. if negative, program terminates, if not, second integer value is input, and the program repeatedly outputs that second value the number of times indicated by the first value. The process then repeats from the very start.
Format that output as follows: following every three values output, a blank displayed. (careful: the count does not reset between sets of outputs.
so far i made
import java.util.*;
class Assignment91
{
public static void main(String [] args)
{
Scanner keyboard = new Scanner(System.in);
int z=0;
while(z==0)
{ int i, b, a;
System.out.println("Please enter an integer, a negative integer will terminate program");
a = keyboard.nextInt();
if(a<0)
System.exit(1);
System.out.println("Please enter another integer");
b = keyboard.nextInt();
for(i=0; i<a; i++)
System.out.println(b);
}
}
}
thanks MIT students!
Format that output as follows: following every three values output, a blank displayed. (careful: the count does not reset between sets of outputs.
so far i made
import java.util.*;
class Assignment91
{
public static void main(String [] args)
{
Scanner keyboard = new Scanner(System.in);
int z=0;
while(z==0)
{ int i, b, a;
System.out.println("Please enter an integer, a negative integer will terminate program");
a = keyboard.nextInt();
if(a<0)
System.exit(1);
System.out.println("Please enter another integer");
b = keyboard.nextInt();
for(i=0; i<a; i++)
System.out.println(b);
}
}
}
thanks MIT students!