Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- int main ()
- {
- int i, n, max=0;
- int *pData;
- scanf("%d",&n);
- pData = (int*)calloc(n, sizeof(int));
- if(pData==NULL) exit(1);
- for (i=0;i<n;i++)
- {
- scanf("%d",&pData[i]);
- if(pData[i]>max)
- max = pData[i];
- }
- printf("The largest element is %d", max);
- free(pData);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement