Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc, char **argv)
- {
- int i = 0, n = 0, c = 0;
- int srednee = 0;
- int sum = 0;
- int min = 0;
- int *a;
- printf("elementide arv = \n");
- scanf("%d", &n);
- if( 0 == n )
- {
- return 0;
- }
- if( n < 1 || n > 10 )
- {
- return 0;
- }
- a = (int*)malloc( sizeof( int ) * n );
- while( i < n )
- {
- printf("vesti chislo:\n");
- scanf("%d", &a[i]);
- i++;
- sum += a[i];
- }
- srednee = sum / n;
- printf("Srednee = %d", srednee);
- for (i=0; i<n; i--)
- {
- min = a[i] - srednee;
- if( min > a[i] )
- {
- min = a[i];
- }
- }
- while( i < n )
- {
- printf("%d ", min);
- }
- free( a );
- return 0;
- }
Add Comment
Please, Sign In to add comment