import java.awt.*;
import java.applet.*;
//
public class spiral extends Applet
{
public void paint(Graphics g)
{
int x1=350,y1=350,x2=400,y2=350,y3,x3,x4,y4,i;
g.drawLine(x1,y1,x2,y2);
x3=x2;
g.drawLine(x2,y2,x3,y3=y2+45);
y4=y3;
x4=x1-25;
g.drawLine(x3,y3,x4,y4);
for(i=1;i<10;i++)
{
x1=x4;
y1=y1-25;
g.drawLine(x4,y4,x1,y1);
y2=y1;
x2=x2+25;
g.drawLine(x1,y1,x2,y2);
x3=x2;
y3=y3+25;
g.drawLine(x2,y2,x3,y3);
y4=y3;x4=x1-25;
g.drawLine(x3,y3,x4,y4);
}
}
}
No comments:
Post a Comment