Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C programming Part A: Short answer type questions: (4 marks) Q1: Why do we include in our programs (1 mark) Q2: What are header files?

C programming

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions

Question

7. What is coaching? Is there only one type of coaching? Explain.

Answered: 1 week ago