Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int apsolutna(int broj) {
- if (broj < 0)
- return -broj;
- return broj;
- }
- int main() {
- int brojevi[5];
- cout << "Unesi brojeve -------------" << endl;
- for (int i = 0; i < 5; i++) {
- cout << "Unesi " << i+1 << ". broj: ";
- cin >> brojevi[i];
- }
- cout << endl;
- cout << "Apsolutne vrijednosti -----" << endl;
- for (int i = 0; i < 5; i++) {
- cout << "|" << brojevi[i] << "| = " << apsolutna(brojevi[i]) << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement