Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(){
- int n,s,min;
- printf("Unesite broj elemenata");
- scanf("%d",&n);
- int *niz=(int*)calloc(n,sizeof(int));
- int i,j,q;
- for(i=0;i<n;i++){
- printf("Unesite %d. element",i+1);
- scanf("%d",niz+i);
- }
- for(i=0;i<n;i++){
- if(*(niz+i)%2==0)
- printf("%d ",*(niz+i));
- }
- for(s=0,i=0;i<n;i++){
- s=s+ (*(niz+i));
- }
- printf("\n Suma je %d", s);
- min=*niz;
- for(i=0;i<n;i++){
- if(min>*(niz+i))
- min=*(niz+i);
- }
- printf("\nNajmanji je %d\n",min);
- for(i=0,q=0;i<n;i++){
- if(min==*(niz+i))
- {
- n--;
- for(j=i;j<n-1;j++){
- *(niz+j)=*(niz+j+1);
- }
- i--;
- }
- }
- niz=(int*)realloc(niz,(n)*sizeof(int));
- for(i=0;i<n;i++){
- printf("%d ",*(niz+i));
- }
- free(niz);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement