Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 2nd, 2020 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #define max 20
  5.  
  6. int main(){
  7.   int array[max], i, count = 0, n;
  8.   double avg = 0;
  9.   printf("Vvedite n: ");
  10.   scanf("%d", &n);
  11.   for(i = 0; i < n; i++){
  12.       array[i] = i + 2;
  13.       printf("Array[%d] = %d\n", i, array[i]);
  14.   }
  15.  
  16.   for(i = 0; i < n; i++){
  17.     int x = 1;
  18.     while(x < array[i])
  19.       x *= 2;
  20.     if (x == array[i]){
  21.       count++;
  22.       avg += array[i];
  23.     }
  24.   }
  25.  
  26.   printf ("\nSrednee = %lf\n", avg / count);
  27.  
  28.   printf("\nIzmenenie massiva:\n");
  29.   printf("Vvedite n: ");
  30.   scanf("%d", &n);
  31.   for(i = 0; i < n; i++){
  32.     printf("Array[%d] = ", i);
  33.     scanf("%d", &array[i]);
  34.   }
  35.  
  36.   printf ("Vivod novogo massiva:\n");
  37.   for(i = 0; i < n; i++)
  38.     printf("Array[%d] = %d\n", i, array[i]);
  39.  
  40.   return 1;
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top