Advertisement
Guest User

ITM OOPs- Program 1

a guest
Apr 15th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1.  
  2. Program 1
  3. #include<iostream.h>
  4. #include<conio.h>
  5. void main()
  6. {
  7. clrscr();
  8. int maxarray(int a[],int n);
  9. int i,a[100],n,m;
  10. cout<<"Enter the number elements of an array"<<"\n";
  11. cin>>n;
  12.  
  13. cout<<"Enter the array elements of array\n";
  14. for(i=0;i<n;i++)
  15. {cin>>a[i];
  16. }
  17. m = maxarray(a,n);
  18. cout<<"\nThe max is "<<m;
  19. getch();}
  20. int maxarray(int a[],int n)
  21. {
  22. int i,max;
  23. for(i=0;i<n;i++)
  24. { max=a[0];
  25. if(a[i]>=max)
  26. max=a[i];
  27. }
  28. return(max);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement