fork download
  1. // C code
  2. // This program will calculate the total number of burpees performed by x number of crossfit
  3. // participants during the 16.5 workout (7 rounds).
  4. // Developer: Daniel Ortiz
  5. // Date: March 26, 201
  6. #include <stdio.h>
  7. int main ()
  8. {
  9.  
  10. /* variable definition: */
  11. int count, value, sum, total, people;
  12.  
  13. /* Initialize */
  14. count = 0;
  15. sum = 0;
  16. total = 0;
  17. people = 0;
  18.  
  19. /* Capture number of participants */
  20. printf("Enter the number of participants\n");
  21. scanf("%d", &people);
  22.  
  23. // Loop through to input values
  24. while (count < 7)
  25. {
  26. printf("Enter a positive Integer\n");
  27. scanf("%d", &value);
  28. if (value >= 0) {
  29. sum = sum + value;
  30. count = count + 1;
  31. }
  32. else {
  33. printf("Value must be positive\n");
  34. }
  35. }
  36.  
  37. // Calculate total.
  38. total = people * sum
  39. printf("Total number of burpees completed by the participants is %d\n ", total );
  40. return 0;
  41. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
2
3
4
5
6
7
compilation info
prog.c: In function ‘main’:
prog.c:39:1: error: expected ‘;’ before ‘printf’
 printf("Total number of burpees completed by the participants is %d\n ", total );
 ^~~~~~
prog.c:11:24: warning: variable ‘total’ set but not used [-Wunused-but-set-variable]
 int count, value, sum, total, people;
                        ^~~~~
stdout
Standard output is empty