fork download
  1.  
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6.  
  7. public class Sample {
  8.  
  9. public static void main(String[] args) throws NumberFormatException, IOException {
  10.  
  11.  
  12. int t = Integer.parseInt(br.readLine());
  13.  
  14. //for(int i=1;i<=1000;i++)
  15. //{
  16. // int u=i;
  17. // int y=i;
  18. int g = getsum(t);
  19. if(g % 4 == 0)
  20. System.out.println(t);
  21. else
  22. {
  23. while(g % 4 != 0)
  24. {
  25. int h = g%4;
  26. t+=(4-h);
  27. g = getsum(t);
  28. }
  29. System.out.println(t);
  30. }
  31. //}
  32.  
  33. }
  34.  
  35. private static int getsum(int t) {
  36. // TODO Auto-generated method stub
  37.  
  38. int sum=0;
  39. while(t > 0)
  40. {
  41. sum+=t%10;
  42. t /=10;
  43. }
  44. return sum;
  45. }
  46.  
  47. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
399
compilation info
Main.java:7: error: class Sample is public, should be declared in a file named Sample.java
public class Sample {
       ^
1 error
stdout
Standard output is empty