0% found this document useful (0 votes)
93 views1 page

Assignment of C Programming

The document contains instructions for a CAT assignment that is due on July 29, 2020 and allows 2 resubmissions until July 31, 2020. It lists 4 programming problems to solve, including writing programs to calculate seconds in a year, number of water molecules given a quantity in quarts, and applying different discount rates based on purchase amounts. It also asks for the meaning of 4 C variable declarations.

Uploaded by

Martin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views1 page

Assignment of C Programming

The document contains instructions for a CAT assignment that is due on July 29, 2020 and allows 2 resubmissions until July 31, 2020. It lists 4 programming problems to solve, including writing programs to calculate seconds in a year, number of water molecules given a quantity in quarts, and applying different discount rates based on purchase amounts. It also asks for the meaning of 4 C variable declarations.

Uploaded by

Martin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

tle

CAT
Due
Jul 29, 2020 12:35 PM
Number of resubmissions allowed
2
Accept Resubmission Until
Jul 31, 2020 12:35 PM
Status
Not Started
Grade Scale
Points (max 30.00)

Instructions

1. The use of comments in C programs is generally considered to be good programming


practice. Why?
2. C is both ‘portable’ and ‘efficient’. Explain.
3. Write a program that computes the number of seconds in a year. The mass of a single
molecule of water is about 3.0 x 10-23 grams. A quart of water is about 950 grams. Write a
program that requests an amount of water in quarts and displays the number of water
molecules in that amount.
4. A retail shop offers discounts to its customers according to the following rules:
Purchase Amount  >= Ksh. 10,000 - Give 10% discount on the amount.
Ksh. 5, 000 <= Purchase Amount < Ksh. 10,000 - Give 5% discount on the amount.
Ksh. 3, 000 <= Purchase Amount < Ksh. 5,000 - Give 3% discount on the amount. 
0 > Purchase Amount  < Ksh. 3,000 - Pay full amount.
5.   Write a program that asks for the customer’s purchase amount, then uses if statements to
recommend the appropriate payable amount. The program should cater for negative purchase
amounts and display the payable amount in each case.
6. Give the meaning of the following declarations;
(i) char name[20];
(ii) int num_emp;
(iii) double tax, basicpay;
(iv) char response;

You might also like