Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<algorithm>
- using namespace std;
- int terbesar(int a[], int n){
- if (n==1)
- return a[n];
- else{
- return max(terbesar(a,n-1),a[n]);
- }
- }
- int main(){
- int a[] = {1, 10, 8, 2, 7, 1};
- int n = sizeof(a) / sizeof(a[0]);
- cout<< "bilangan terbesar adalah "<< terbesar(a, n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment