shouldz

Valores entre 100 e -100

Oct 1st, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public class primeiroPrograma{
  2. public static void main(String[] args) {
  3. int x;
  4. int y;
  5. int soma;
  6. int contador = 0;
  7. for(x = 100; x != -100; x--){
  8. for(y = -100; y != 100; y++){
  9. soma = x + y;
  10. if(soma == 100 | soma == -100){
  11. System.out.println(x);
  12. System.out.println(y);
  13. contador += 1;
  14. }
  15. }
  16. }
  17. System.out.println("Valores possiveis: " + contador);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment