What's new

Closed Pahelp po tnx .

Status
Not open for further replies.

UY Scuti

Honorary Poster
Joined
Jun 16, 2015
Posts
609
Reaction
327
Points
221
import javax.swing.JOptionPane;
import javax.swing.JTextArea;

public class random {

public static void main(String[] args) {

int value;
int sum = 0;

JTextArea number = new JTextArea();

for (int counter = 1; counter <= 16; counter++) // loop 16 times
{
value = (int) (Math.random() * 9); // pick random integer between 0 and 9

number.append(value + " "); // append value
sum += value; // count sum

if (counter % 4 == 0) // if counter divisible by 4, append newline
{
number.append("= " + sum);
number.append("\n");
sum = 0; // reset line_sum
}

}
JOptionPane.showMessageDialog(null, number);
System.exit(0);
}
}


pahelp nmn po ako .as of now po kasi ang output ng code ko is ganito :

4 0 0 4 = 8
3 6 3 6 = 18
1 1 5 1 = 8
1 0 5 1 = 7

gusto ko po sana na iadd cla pababa .parang ganito po :

4 0 0 4
3 6 3 6
1 1 5 1
1 0 5 1
9 7 13 12 -> ito po sagot nila pag i-nad pababa
 
Dear dj_andia,

Since 2 years have passed since the last reply in this thread, I am locking it to prevent necroposting. Feel free to start a new thread or contact any forum staff if you want this to be reopened.

Thread closed.
 
Status
Not open for further replies.

Similar threads

Back
Top