J2D50

# ТЕСТ

file etest.c

  #include <time.h>
  #include <stdio.h>
  #include <stdlib.h>

  int other(int arand, int arem) {
    int newrand;
    do {
      newrand=rand()%arem;
    } while(arand==newrand);
    return newrand;
  }

  int main() {
    int RR[] = { 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000 };
    int r;
    srand(time(NULL));
   
    r=rand()%5; 
    printf(
      "\nE\t%d\tVolt\t%d\t%d\n\n", 
      RR[rand()%10], r, other(r,5)
    );
    for(int n=0; n<10; n++) {
      r=rand()%5;
      printf(
        "R%d\t%d\tOhm\t%d\t%d\n", 
        n, RR[rand()%10], r, other(r,5)
      );
    }
    r=rand()%5;
    printf(
      "\nFind Voltage between %d and %d\n\n", 
      r, other(r,5)
    );
    printf(
      "Calculate here: "
      "https://github.com/zupolgec/circuit-simulator\n\n"
    );
    return 0;
  }
  
EOF
  
