fork download
  1. import java.util.Scanner;
  2. public class avg {
  3. public void main(String args[])
  4. {
  5. Scanner obj1=new Scanner(System.in);
  6. int Sum=0,i,marks=0;
  7. while(i<10)
  8. {
  9. System.out.println("Enter the %d",+i ,"th subject marks");
  10. marks=obj1.nextInt();
  11. Sum+=marks;
  12. i++;
  13.  
  14. }
  15. double avg=Sum/10;
  16. System.out.println("The avg is",+avg);
  17.  
  18. }
  19. }
  20.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:2: error: class avg is public, should be declared in a file named avg.java
public class avg {
       ^
Main.java:9: error: no suitable method found for println(String,int,String)
    		   System.out.println("Enter the %d",+i ,"th subject marks");
    		             ^
    method PrintStream.println() is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(boolean) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(char) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(int) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(long) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(float) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(double) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(char[]) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(String) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(Object) is not applicable
      (actual and formal argument lists differ in length)
Main.java:16: error: no suitable method found for println(String,double)
    	   System.out.println("The avg is",+avg);
    	             ^
    method PrintStream.println() is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(boolean) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(char) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(int) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(long) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(float) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(double) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(char[]) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(String) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(Object) is not applicable
      (actual and formal argument lists differ in length)
3 errors
stdout
Standard output is empty