can someone help me and tell me what is wrong, I can't figure it out. It is pointing to the line "public class Lab4.24"

import java.util.Scanner;

public class Lab4.24
  {
  public static void main(String[] args) {

  int i; float sum;
  i=3;
  sum=0;
  while(i<=99)
  {
  sum=sum + ( (i-2)/i);
  i=i+2;
  }
  printf(" sum %f\n", sum);
 }
}

You can't have a dot (.) in your class name. Remove it or use underscore (_) instead.

You can't have a . in a name. Lab4.24 is not a valid name in Java. You could use Lab4_24 if you wanted.

(And with respect to the next error message, remember 'System.out.' ;) )

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.