Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package javaapplication1;
  7.  
  8. /**
  9. *
  10. * @author Ahmed
  11. */
  12.  
  13.  
  14. public class JavaApplication1 {
  15.  
  16. /**
  17. * @param args the command line arguments
  18. */
  19. num sum=0;
  20. public static void main(String[] args) {
  21. // TODO code application logic here
  22. for(int i=2;i>=30;i++)
  23. {
  24. if(i%2==0)
  25. {
  26. sum+=i;
  27. }
  28. else {
  29. sum+=i+1;
  30. }
  31. }
  32. System.out.println("sum:" + sum);
  33.  
  34. }
  35. }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement