Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n, a[100];
- cout << "Nhap n: "; cin >> n;
- for (int i = 0; i < n; i++) {
- cout << "Nhap a[" << i << "] = ";
- cin >> a[i];
- }
- int val = a[0], pos = 0;
- for (int i = 1; i < n; i++) {
- if (a[i] < val) {
- val = a[i];
- pos = i;
- }
- }
- cout << "So nho nhat: " << val << '\n';
- cout << "Vi tri: " << pos << '\n';
- return 0;
- }
Add Comment
Please, Sign In to add comment