Untitled
unknown
plain_text
a year ago
1.2 kB
24
Indexable
Scanner matish = new Scanner(System.in);
System.out.println("Unesite dva cela broja: ");
int cb1 = matish.nextInt();Integer.parseInt(matish.nextLine());
int cb2 = matish.nextInt();Integer.parseInt(matish.nextLine());
System.out.println("Izaberite jednu od operacija: +, -, *, / ili %: ");
char oper = matish.nextLine().charAt(0);
char plus = '+';
char min = '-';
char put = '*';
char pod = '/';
char post = '%';
if (oper == '+') {
System.out.println("Zbrir unetih brojeva je: " + (cb1 + cb2) + " .");
} else if (oper == '-') {
System.out.println("Razlika prvog unetog broja drugim je: " + (cb1 - cb2) + " .");
} else if (oper == '*') {
System.out.println("Proizvod unetih brojeva je: " + (cb1 * cb2) + " .");
} else if (oper == '/') {
System.out.println("Količnik prvog unetog broja drugim je: " + (cb1 / cb2) + " .");
} else if (oper == '%') {
System.out.println("Ostatk pri deljenju unetih brojeva je: " + (cb1 % cb2) + " .");
} else {
System.out.println("Pogrešan unos. Pokušajte ponovo.");
}
//
}
}Editor is loading...
Leave a Comment