Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. // Napisz program sumujacy liczby cztercyfrowe podzielne przez 3 i niepodzielne przez 4.
  2.  
  3. public class A_2
  4. {
  5.     public static void main (){
  6.         int liczba = 1000;
  7.         int suma = 0;
  8.         int a;
  9.  
  10.         for (int i=0 ; i<9000; i++) {
  11.             a = liczba + i;
  12.  
  13.             if (a%3 == 0 && a%4 != 0) {
  14.                 suma += a;
  15.             }
  16.         }
  17.         System.out.println ("Suma liczb czterocyfrowych podzielnych przez 3 i niepodzielnych przez 4 to: "+suma);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement