Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

An electric power substation measures voltages hourly for 72 continuous hours be

ID: 3801859 • Letter: A

Question

An electric power substation measures voltages hourly for 72 continuous hours before they send off a report to the manager. Write a C program to generate this report that reads in 72 integer voltage readings from standard input in order to determine: the mean voltage over the time period the hours at which the recorded voltage varies from the mean by more than 10% any adjacent hours when the change from one reading to the next was greater than 15% of the mean the hours when a brownout occurred You must store the voltage readings in an array. You may assume that all of the values inputted are legal (i.e., 0

Explanation / Answer

#include<stdio.h>
int mean;
void print(int arr[])//to print
{
   int iloop,ch=0;
   for(iloop=0;iloop<72;iloop++)
   {
       printf("%d ",arr[iloop]);
       ch=ch+1;
       if(ch>11)
       {
           printf(" ");
           ch=0;
       }
   }
}
void arrmean(int arr[])//to calculate mean
{
   int add=0,i;
   for(i=0;i<72;i++)
   {
       add=add+arr[i];
   }
   mean=add/10;
   printf(" Mean Of Voltages is : %d",mean);
}
void hrvariesmean(int arr[])//diff by 10%
{
   int i,m=mean;
   for(i=0;i<72;i++)
   {
      
       if(arr[i]>=m*1.10||arr[i]<=m*0.90)
       {
           printf(" Hour At Which Mean Varies by 10 Percent: %d",i+1);
       }
   }
}
void hrvarmean(int arr[])//diff by 15%
{
   int i,volt,m=mean*0.15;
   for(i=1;i<72;i++)
   {
       if(arr[i]-arr[i-1]>m)
       {
           printf(" Hour At Which Mean Varies by 15 Percent : %d",i+1);
       }
   }
}
void brownout(int arr[])//for brownout
{
   int i,volt;
   for(i=0;i<72;i++)
   {
       if(arr[i]<107.04)//as 107.04 is 10.8% less of 120
       {
           printf(" Hour At Which Brownout occured: %d",i+1);
       }
   }
}


int main(void)
{
   int arr[72];
   int max=72;
   int iloop;
   printf(" Enter The Voltages recorded of 72 Hours:");
   for(iloop=0;iloop<max;iloop++)
   {
       printf(" Enter The Voltage for %d hr.:",iloop+1);
       scanf("%d",&arr[iloop]);
   }
   print(arr);
   arrmean(arr);
   hrvariesmean(arr);
   hrvarmean(arr);
   brownout(arr);
}//end of main

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote