Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- float avg, total, temp, fifteen;
- float voltages[10];
- int index, count;
- int main() {
- printf("Type in voltages for 6 hours\n\n");
- total=0.0;
- for(index=0; index<6; index++){
- printf("Enter a voltage for hour %d: ", index+1);
- scanf("%f", &voltages[index]);
- total=total+voltages[index];
- }
- avg=total/6.0;
- printf("The average of voltages %1.2f \n", avg);
- temp=10*avg/100;
- printf("10%%= %1.2f \n", temp);
- fifteen=15*avg/100;
- printf("15%%= %1.2f \n", fifteen);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement