Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Resistance Calculator
- //Adam Robbins 2011
- #include <stdio.h>
- #include <stdlib.h>
- float v,i,r; //set up various variables
- char vin[256];
- char iin[256];
- int main()
- {
- printf("What is the Voltage?\n"); //ask for the voltage
- scanf("%s",&vin); //read the input
- v = atof(&vin); //convert to floats
- printf("\nWhat is the Current?\n"); //ask for the current
- scanf("%s",&iin); //read the input
- i = atof(&iin); //convert to floats
- r = v / i; //do the sum
- printf("\n\nThen the Resistance must be... %f\n\n",r); //print the answer
- return 0; //stop moaning and shut up
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement