#include <stdio.h>/* Replacement resistance. */int ohm_calc(float ampere, float volt, float ohm){ float result = 0; if((ampere == 0) && (volt == 0) && (ohm == 0)) { printf("You have to give at least two values.\n"); } if(ampere == 0) { result = volt / ohm; printf("Volt: %f\nOhm: %f\nAmpere: %f\n", volt, ohm, result); } if(volt == 0) { result = ohm * ampere; printf("Volt: %f\nOhm: %f\nAmpere: %f\n", result, ohm, ampere); } if(ohm == 0) { result = volt / ampere; printf("Volt: %f\nOhm: %f\nAmpere: %f\n", volt, result, ampere); } return 0;}/* Main function */int main(){ int which; float volt, ampere, ohm; int i; int size; float result = 0; float result2 = 0; float result3 = 0; printf("What do you wanna calculate?\n0 = Ohm, Ampere or Voltage.\n1 = Replacement resistance. (Paralell)\n2 = Replacemnt Resistance (Serial)\n\n"); printf("Choose:_\b"); scanf("%d", &which); switch(which) { case 0: printf("Welcome. Give me the values of Ohm, Ampere and Voltage.\n"); printf("The one you set as 0 is the one that is going to be calculated.\n"); printf("Volt:_____\b\b\b\b\b"); scanf("%f", &volt); printf("Ampere:_____\b\b\b\b\b"); scanf("%f", &ere); printf("Ohm:_____\b\b\b\b\b"); scanf("%f", &ohm); ohm_calc(ampere, volt, ohm); break; case 1: result = 0; result2 = 0; result3 = 0; printf("Give me how many numbers you are going to use.\n"); printf("Size:__\b\b"); scanf("%d", &size); for(i = 0; i < size; ++i) { printf("Give me number %d:", i + 1); scanf("%f", &result2); result3 = 1 / result2 + result3; result2 = 0; } result = 1 / result3; printf("%f\n", result); break; case 2: result = 0; printf("Give me how many numbers you are going to use.\n"); printf("Size:__\b\b"); scanf("%d", &size); for(i = 0; i < size; i++) { printf("Give me number %d:", i +1); scanf("%f", &result); result2 += result; } printf("Result: %f\n", result2); break; } return 0;}