Thứ Tư, 11 tháng 11, 2015

Try it yourself session 6

1.    A. Use the printf() statement and do the following:

a. Print out the value of the integer variable sum
b. Print out the text string “Welcome”, followed by a new line.
c. Print out the character variable letter.
d. Print out the float variable discount.
e. Print out the float variable dump using two decimal places.


        B. Use the scanf() statement and do the following:

a. To read a decimal value from the keyboard, into the integer variable sum
b. To read a float variable into the variable discount_rate


2. Write a program which prints the ASCII values of the characters ‘A’ and ‘b’.


4. Write a program which takes name, basic , daper ( ie, percentage of D.A), bonper (ie, percentage bonus) and loandet ( loan amount to be debited) for an employee. Calculate the salary using the following relation:

salary = basic + basic * daper /100 +bonper * basic/100 - loandet
Data is:
name           basic     daper      bonper       loandet
M A R K     2500      55            33.33          250.00
Calculate salary and then print the result under the following headings.
(Salary to be printed to the nearest dollar.)
Name                            Basic                        Salary


5. Write a program that asks for your first name and last name, and then prints the names in the format last name, first name.



Không có nhận xét nào:

Đăng nhận xét