• Write a program that receives voltage and resistance from the user and then calculates the current

0 votes
asked Feb 29 by Lilliano
• Note : Voltage=resistance*current

3 Answers

+1 vote
answered Mar 2 by anonymous
V=float(input('Enter the voltage:'));
R=float(input('Enter the resistance:'));
I=V/R;
print('Current =',I)
0 votes
answered Mar 5 by anonymous
#include <stdio.h>

int main()
{
    float voltage, resistance, current = 0.00;
    
    printf("Please enter a voltage reading: ");
    scanf("%f", &voltage);

    printf("\nPlease enter a resistance reading: ");
    scanf("%f", &resistance);
    
    current = resistance * voltage;
    
    printf("\nVolatage %f", current);  //can do %.4f to have 4 digits after decimal point.

    return 0;
}
0 votes
answered Mar 5 by srikanth
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    float resistance,voltage,current;
    cout<<"Enter resistance : ";
    cin>>resistance;
    cout<<"Enter voltage : ";
    cin>>voltage;
    current=voltage/resistance;
    cout<<"current = "<<current<<endl;
    return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...