fork download
  1. import java.util.*;
  2. class main
  3. {
  4. public static void main(String[] args)
  5. {
  6. Scanner in =new Scanner(System.in);
  7. int n,m;
  8. int s=0;
  9. System.out.println("Enter the two numbers");
  10. n=in.nextInt();
  11. m=in.nextInt();
  12. for(int i=n;i<m;i++)
  13. s=s+(i*i*i);
  14.  
  15. System.out.println("Result "+s);
  16. }
  17. }
Success #stdin #stdout 0.18s 58796KB
stdin
4
8
stdout
Enter the two numbers
Result 748