Advertisement
Hiitmarqes

Untitled

Oct 18th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. package main;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Eginima{
  6.  
  7. public static void main(String[] args) {
  8. Scanner ler = new Scanner(System.in) ;
  9. int iContador;
  10. int somaNumeroPares = 0;
  11. int somaNumerosMult3 = 0;
  12. int somaTotal = 0, somaTotall=0;
  13. int somaNumeros = 0, iContadorNumeroImpa = 0;
  14.  
  15. for (iContador = 1; iContador <= 1945; iContador++) {
  16.  
  17. if (iContador % 2==0)
  18. somaNumeroPares += iContador;
  19. if (iContador % 3==0)
  20. somaNumerosMult3 += iContador;
  21. }
  22. //
  23. somaTotal= ((somaNumeroPares + somaNumerosMult3) * 3);
  24.  
  25. for (iContador = 1; iContador <= somaTotal; iContador++) {
  26. somaNumeros += iContador;
  27. }
  28.  
  29. for (iContador = 1; iContador <= 1992; iContador++) {
  30. if(iContador%2 != 0) iContadorNumeroImpa++;
  31. }
  32.  
  33. somaTotall = 1939 + somaTotal + iContadorNumeroImpa;
  34. somaTotal= (somaTotall * somaTotall) - somaNumeroPares;
  35.  
  36. System.out.println(somaTotal);
  37. ler.close();
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement