Friday, May 3, 2013

Voltage:Sum of total voltage in circuit.

Write a program in c to find total voltage in circuit
  V=V1+V2+V3+.....+Vn 




#include<stdio.h>
main()
{
    int V,I,R,n,sum=0,i;
    printf("\n\tIT'S A PROGRAM TO FIND THE TOTAL VALUE OF VOLTAGE IN A CIRCUIT\n");
    printf("\n\tEnter the range value of series:");
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        printf("\nEnter the  value of current:");
        scanf("%d",&I);
        printf("\nEnter the value of resistance:");
       scanf("%d",&R);
       V=(I*R);
       sum+=V;
    }
   printf("\n\tTotal voltage is: %d\n",sum);
   return 0;
}
 


No comments:

Post a Comment