Practice Learning Problems for C89
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
714B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main(void){
  4. double score1;
  5. double score2;
  6. double score3;
  7. int return_code;
  8. printf("Howdy You will now be asked to input the 3 scores\n");
  9. printf("Score 1: ");
  10. fflush(stdout);
  11. return_code = scanf("%lg", &score1);
  12. if(return_code != 1){
  13. return EXIT_FAILURE;
  14. }
  15. printf("Score 1 submitted succesfully\n");
  16. printf("Score 2: ");
  17. fflush(stdout);
  18. return_code = scanf("%lg", &score2);
  19. if (return_code != 1){
  20. return EXIT_FAILURE;
  21. }
  22. printf("Score 2 submitted succesfully\n");
  23. printf("Score 3: ");
  24. fflush(stdout);
  25. return_code = scanf("%lg", &score3);
  26. if (return_code != 1){
  27. return EXIT_FAILURE;
  28. }
  29. printf("Your scores were %f, %f, %f\n", score1, score2, score3);
  30. return 0;
  31. }