Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4. int main ()
  5. {
  6. int i, n, max=0;
  7. int *pData;
  8. scanf("%d",&n);
  9. pData = (int*)calloc(n, sizeof(int));
  10. if(pData==NULL) exit(1);
  11. for (i=0;i<n;i++)
  12. {
  13. scanf("%d",&pData[i]);
  14. if(pData[i]>max)
  15. max = pData[i];
  16. }
  17. printf("The largest element is %d", max);
  18. free(pData);
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement