Question: C PROGRAMMING (POSTING AGAIN BECAUSE NO SOLUTION PROVIDED PREVIOUSLY) Part A: Short answer type questions: (4 marks) Q1: Why do we include in our programs

C PROGRAMMING

(POSTING AGAIN BECAUSE NO SOLUTION PROVIDED PREVIOUSLY)

C PROGRAMMING (POSTING AGAIN BECAUSE NO SOLUTION PROVIDED PREVIOUSLY) Part A: Shortanswer type questions: (4 marks) Q1: Why do we include in our

Part A: Short answer type questions: (4 marks) Q1: Why do we include in our programs (1 mark) Q2: What are header files? Why are they important? Can we write a C program without using any header file? (3 marks) Part B: Programming (25 marks) ***For every program, arintf ("The purpose of the program is| to.............") at the very beginning Q1: Write a program to read a character in upper case and then print it in lower case. (5 marks) (Hint: ASCII value of A is 65 and ASCII value of a is 97. So to convert a character from uppercase to lowercase, we have to add (97-65) i.e., 32 to get the ASCII value of the character in lowercase). Requirements: character to be read as "kh". Output should be "[Your First Name and Last Name]" converts the upper case to lower case. Q2: Write a program to swap two numbers without using a temporary variable. (5 marks) Requirements: numbers to be input nmbi, nmb2 Output should be "[Your student number}" The first number is: The second number is: PROG 20799: Data Structures and Algorithms in C Sheridan College Q3. Write a program to enter a number from 1-7 and display the corresponding day of the week using switch case statement. (5 marks) Requirements: The name of the days to be printed Sunday (alternate cases) Also print "The value entered (if it is not 1-7) is not a valid number" Q4. Write a program to prepare a grocery bill for Freshse (10 marks) a) Exhibit the use of do-while statement (2 marks) b) Exhibit the use of switch - case (3 marks) The following table should be displayed before the user enters his choice. (2 marks) Enter the name of the items purchased and its price per unit. Item Name Cost per unit Item Name Cost per unit Coca Cola $1 Hungry Man $ 2 Janes Wings S 5 (Rounded) Maxwell House S3 (Rounded) (3 marks) Then display the bill in exactly the following format. ##### #### FRESH CO BILL ######### Item Quantity Price Amount Total Amount to be paid

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!