Advertisement
Svetlana_Ovsjanikova

java - summa

Sep 21st, 2019
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 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 day2_summa;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11. *
  12. * @author sao_7
  13. */
  14. public class Day2_summa {
  15.  
  16. /**
  17. * @param args the command line arguments
  18. */
  19. public static void main(String[] args) {
  20. Scanner sc = new Scanner(System.in);
  21. //Cilveks ievada 3 skaitlus
  22. //mes sos skaitlus saskaitam
  23. int sum = 0;
  24. //jauztaisa kur glabat summu
  25. for(int i = 0; i < 3; i++){
  26. System.out.println("Ievadiet skaitli!");
  27. int number = sc.nextInt();
  28. sum = sum + number;
  29. }
  30. System.out.println("Summa ir " + sum);
  31. //Cikla mes laujam cilvekam ievadit skaitli
  32. //pieskaitam summai
  33. //arpus cikla summa jaizvada
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement