Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Napisz program sumujacy liczby cztercyfrowe podzielne przez 3 i niepodzielne przez 4.
- public class A_2
- {
- public static void main (){
- int liczba = 1000;
- int suma = 0;
- int a;
- for (int i=0 ; i<9000; i++) {
- a = liczba + i;
- if (a%3 == 0 && a%4 != 0) {
- suma += a;
- }
- }
- System.out.println ("Suma liczb czterocyfrowych podzielnych przez 3 i niepodzielnych przez 4 to: "+suma);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement