Main.java 442B

123456789101112131415161718192021222324
  1. /**
  2. * Created by iyasuwatts on 10/17/17.
  3. */
  4. import java.util.Scanner;
  5. public class Main {
  6. int a;
  7. int b;
  8. public static void main(String[] args){
  9. Scanner num = new Scanner(System.in);
  10. System.out.println("Enter Number");
  11. int a = num.nextInt();
  12. int sum = 0;
  13. int b=0;
  14. while(b<=a){
  15. sum +=b;
  16. b++;
  17. }
  18. System.out.println(sum);
  19. }
  20. }