Ohm’s law explains the relationship between voltage and current flowing through resistors. The mathematical formula is V=IR.
C Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
int v,i,r;
printf("Enter current(Amphere):");
scanf("%d",&i);
printf("Enter Resistance(Ohm):");
scanf("%d",&r);
v=i*r;
printf("Voltage of the circuit is %d",v);
return 0;
}
Java Program
import java.util.Scanner;
public class Swap {
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
int v,i,r;
System.out.print("current(Amphere):");
i = s.nextInt();
System.out.print("Enter Resistance(Ohm):");
r = s.nextInt();
v=i*r;
System.out.print("Voltage of the circuit is " + v);
}
}
Python Program
i = int(input("Enter value of current in amphere: "))
R = int(input("Enter value of Resistance in ohm: "))
v = i*R
print("The voltage(V) applied is: " + str(v))
0 Comments:
Post a Comment