Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. void in(int *pmax,int pp);
  4. void nhapMang(int a[],int *pn)
  5. {
  6. printf("nhap so phan tu cua mang: ");
  7. scanf("%d",pn);
  8. for (int i=0;i<*pn;i++)
  9. {
  10. scanf("%d",a+i);
  11. }
  12. }
  13. void Max_vt(int a[], int *pn, int *pmax, int pp)
  14. {
  15. *pmax = a[0];
  16. for (pp = 0;pp<*pn;pp++)
  17. {
  18. if (a[(pp)] > *pmax )
  19. {
  20. *pmax = a[(pp)];
  21. }
  22. }
  23. in(&pmax,pp);
  24. }
  25. void in(int *pmax, int pp)
  26. {
  27. printf("phan tu lon nhat: %d\n",*pmax);
  28. printf("vi tri: %d",pp);
  29. }
  30. int main()
  31. {
  32. int pmax, pp, pn, a[100];
  33. nhapMang(a,&pn);
  34. Max_vt(a,&pn,&pmax,pp);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement