JAVA CODE

//Sum1 program

import java.applet.Applet;
import java.awt.*;

public class Sum1 extends Applet
{
  public void paint( Graphics g )
  {
    double sum = 0;
    for (int i=1; i<6; i++)
    {
      sum = sum+1.0/i;
    }
      g.drawString(" The Sum is " + sum, 20, 20 );

    int sqrsum = 0;
    for (int i=1; i<6; i++)
    {
      sqrsum = sqrsum + i*i;
    }
      g.drawString(" The Sqrsum is " + sqrsum, 50, 50 );
   }
}