23.1.23020056. Generisati 3 dvocifrena broja. Naći sumu parnih.
Opis rješenja:
Listing programa:
/* 23020056 Generisati 3 dvocifrena broja. Naći sumu parnih. */
package Kombinovani;
import java.util.Scanner;
public class Zadatak {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int a = (int) ((100-10) * Math.random() + 10);
System.out.println(a);
int b = (int) ((100-10) * Math.random() + 10);
System.out.println(b);
int c = (int) ((100-10) * Math.random() + 10);
System.out.println(c);
int suma = 0;
if(a % 2 == 0){
suma = suma + a;
}
if(b % 2 == 0){
suma = suma + b;
}
if(c % 2 == 0){
suma = suma + c;
}
System.out.println(suma);
}
}
Ispis na ekranu:
Riješeni zadaci Index
|