Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- float a[50];
- float sr=0;
- int n;
- int i;
- int br0=0;
- printf("Unesite broj elemenata");
- scanf("%d",&n);
- printf("\nUnesite niz ");
- for(i=0;i<n;i++){
- scanf("%f",&a[i]);
- }
- for(i=0;i<n;i++){
- sr=sr+a[i];
- }
- for(i=0;i<n;i++){
- if(a[i]==0)
- br0++;
- }
- sr=sr/n;
- printf("srednja vrednost je %.2f",sr);
- printf("\nBroj nula je %d",br0);
- printf("\nNiz: ");
- for(i=0;i<n;i++){
- printf("%.2f ",a[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement