import java.awt.*;
import java.applet.*;
import java.awt.Graphics;
import javax.swing.*;
public class deret1 extends Applet {
StringBuffer sb;
public void init() {
sb = new StringBuffer();
String temp;
int n;
temp = JOptionPane.showInputDialog("Masukkan Banyak Data");
n=Integer.parseInt(temp);
for(int i=0; i<=n; i++){
sb.append(i);
sb.append(" ");
}
}
public void paint(Graphics g) {
g.drawString(sb.toString(),50, 60 );
}
}
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar