fork download
  1.  
  2. #include <stdio.h>
  3.  
  4.  
  5. main()
  6. {
  7. int package, tourist, TOTAL; /* declare variable */
  8.  
  9.  
  10. puts("WELCOME TO SHAZA TOURISM SDN BHD\n"); /* output */
  11.  
  12. puts("====================================================="); /* output */
  13. puts("Package no\t""Package Type\t\t""Package Rate per pax"); /* output */
  14. puts("====================================================="); /* output */
  15. puts("1\t""Langkawi\t\t""RM300\t"); /* output */
  16. puts("2\t""Tioman\t\t""RM400\t"); /* output */
  17. puts("3\t""Pangkor\t\t""RM210\t"); /* output */
  18. puts("4\t""Cherating\t\t""RM350\t"); /* output */
  19.  
  20. printf("Please enter package number: "); /* requesting for input */
  21. scanf( "%d", &package ); /* to receive input from user */
  22.  
  23. printf("Please enter number of tourist: "); /* requesting for input */
  24. scanf( "%d", &tourist); /* to receive input from user */
  25.  
  26. if (package == 1) /* compare statement */
  27. {
  28. TOTAL=300*tourist; /* calculate */
  29. printf("The total cost is %d",TOTAL); /* output */
  30. }
  31.  
  32. if (package == 2) /* compare statement */
  33. {
  34. TOTAL= 400*tourist; /* calculate */
  35. printf("The total cost is %d",TOTAL); /* output */
  36. }
  37.  
  38.  
  39. if (package == 3) /* compare statement */
  40. {
  41. TOTAL= 210*tourist; /* calculate */
  42. printf("The total cost is %d",TOTAL); /* output */
  43. }
  44.  
  45.  
  46. if (package == 4) /* compare statement */
  47. {
  48. TOTAL= 350*tourist; /* calculate */
  49. printf("The total cost is %d",TOTAL); /* output */
  50. }
  51. else puts("INVALID PACKAGE NUMBER"); /* output */
  52.  
  53. }
  54.  
Success #stdin #stdout 0.01s 5308KB
stdin
Standard input is empty
stdout
WELCOME TO SHAZA TOURISM SDN BHD

=====================================================
Package no	Package Type		Package Rate per pax
=====================================================
1	Langkawi		RM300	
2	Tioman		RM400	
3	Pangkor		RM210	
4	Cherating		RM350	
Please enter package number: Please enter number of tourist: INVALID PACKAGE NUMBER