Advertisement
Guest User

Untitled

a guest
Sep 11th, 2013
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. float avg, total, temp, fifteen;
  4. float voltages[10];
  5. int index, count;
  6.  
  7. int main() {
  8. printf("Type in voltages for 6 hours\n\n");
  9. total=0.0;
  10. for(index=0; index<6; index++){
  11. printf("Enter a voltage for hour %d: ", index+1);
  12. scanf("%f", &voltages[index]);
  13. total=total+voltages[index];
  14. }
  15. avg=total/6.0;
  16. printf("The average of voltages %1.2f \n", avg);
  17. temp=10*avg/100;
  18. printf("10%%= %1.2f \n", temp);
  19. fifteen=15*avg/100;
  20. printf("15%%= %1.2f \n", fifteen);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement