SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <iostream> | |
| 2 | #include <math.h> | |
| 3 | #include <iomanip> | |
| 4 | ||
| 5 | using namespace std; | |
| 6 | int main(){
| |
| 7 | - | int main() |
| 7 | + | |
| 8 | - | {
|
| 8 | + | int n[20]; |
| 9 | - | float x,y,d; |
| 9 | + | int nm; |
| 10 | - | cout << "Nikola Krudulj IV3" << endl; |
| 10 | + | cout << "Program 3 | Veljko Kovacevic IV3" << endl; |
| 11 | - | cout << "X: "; |
| 11 | + | |
| 12 | - | cin >> x; |
| 12 | + | for(int i = 0; i < 20; i++) {
|
| 13 | - | cout << "Y: "; |
| 13 | + | cout << "n[" << i << "] : "; |
| 14 | - | cin >> y; |
| 14 | + | cin >> n[i]; |
| 15 | - | d = sqrt(pow(x, 2) + pow(y, 2)); |
| 15 | + | } |
| 16 | - | cout << setw(7) << setprecision(3) << d; |
| 16 | + | |
| 17 | - | return 0; |
| 17 | + | nm = n[0]; |
| 18 | - | } |
| 18 | + | |
| 19 | - | |
| 19 | + | for (int i = 0; i < 20; i++) |
| 20 | if(n[i] < nm) nm = n[i]; | |
| 21 | ||
| 22 | cout << "Najmanji broj u nizu je " << nm << endl; | |
| 23 | ||
| 24 | cout << "Niz: " << endl; | |
| 25 | for (int i = 0; i < 20; i++) | |
| 26 | cout << n[i] << " "; | |
| 27 | } |