Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by Fimor ( 12 years ago )
#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
 int i, j, n;

 float a[100], c = 0;

 do {
  printf("vvedite razmer massiva:");
  scanf("%i", &n);
 } while (n < 3);

 for (i = 0; i < n; i++) {
  printf("a[%i]=", i+1);
  scanf("%f", &a[i]);
  c += a[i];
 }

 c /= n;

 for (i = 0; i < n; i++) {

  if ((a[i] < c * 0.5) || (a[i] > c * 1.5)) {
   n--;
   for (j = i; j < n; j++) {
    a[j] = a[j + 1];    
   }
   i = 0;
  }

 }

 printf("razmer massiva:%i", n);

 for (i = 0; i < n; i++) {
  printf("\na[%i]=%f", i + 1, a[i]);
 }

 return 0;
}

 

Revise this Paste

Your Name: Code Language: