fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.  
  7. float choice;
  8.  
  9. printf("Choose a product from the below choices:\n");
  10. printf("\t1) Intel® Core™ i7-5960X 8-Core 3.0GHz LGA 2011-v3 140W Desktop Processor 1049.99 \n");
  11. printf("\t2) Intel® Core™ i7-5820K 6-Core 3.3GHz LGA 2011-v3 140W Desktop Processor 389.99 \n");
  12. printf("\t3) AMD FX-9590 8-Core 4.7GHz Socket AM3+ 220W Desktop Processor - Black Edition 229.99 \n");
  13.  
  14. printf("Enter your choice: ");
  15. scanf("%f", &choice);
  16.  
  17. switch( choice )
  18. {
  19. case 1:
  20. printf("You chose 1!\n");
  21. break;
  22. case 2:
  23. printf("You chose 2!\n");
  24. break;
  25. case 3:
  26. printf("You chose 3!\n");
  27. break;
  28. default:
  29. printf("You did not choose an applicable option!\n");
  30. break;
  31. }
  32.  
  33. return 0;
  34. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
2
compilation info
prog.c: In function 'main':
prog.c:17:13: error: switch quantity not an integer
     switch( choice )
             ^
stdout
Standard output is empty