Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

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

–1 vote
asked Feb 29, 2020 by Lilliano
• Note : Voltage=resistance*current

3 Answers

+1 vote
answered Mar 2, 2020 by anonymous
V=float(input('Enter the voltage:'));
R=float(input('Enter the resistance:'));
print('Current =',I)
0 votes
answered Mar 5, 2020 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, 2020 by srikanth
using namespace std;
int main()
    float resistance,voltage,current;
    cout<<"Enter resistance : ";
    cout<<"Enter voltage : ";
    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.