Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- const int n = 3;
- //no 3
- int nMax(int A[][n],int l){
- int max = -99999;
- for(int r=0; r < l; r++){
- for(int c=0; c < l; c++){
- if (max < A[r][c]){
- max = A[r][c];
- }
- }
- }
- return max;
- }
- int main(){
- int A[n][n];
- // No 1
- for(int r=0; r < n; r++){
- for (int c= 0; c < n; c++){
- cout << "A[" << r << "][" << c << "] = ";
- cin >> A[r][c];
- }
- }
- //No 2
- for(int r=0; r < n; r++){
- cout << endl;
- for (int c= 0; c < n; c++){
- cout << "\t" << A[r][c] << "\t";
- }
- }
- //no 3
- int maks = nMax(A,n);
- cout << endl << "Nilai Maksimum Adalah : " << maks;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement