# Programming Exercises

 1: The currency on planet Blipos is called sopilbs. The aliens on Blipos pay the following amount of tax depending on their income: 0% of income less than or equal to 10000 sopilbs 5% of income that is greater than 10000 and less than or equal to 25000 sopilbs 10% of income that is greater than 25000 and less than or equal to 50000 sopilbs 15% of income that is greater than 50000 and less than or equal to 100000 sopilbs 20% of income that is greater than 100000 sopilbs So if an alien earns 60000 sopilbs, it will have to pay the following amount in tax: 0 * 10000 + 0.05 * 15000 + 0.1 * 25000 + 0.15 * 10000 = 4750. Write a program that accepts a certain income as input and from that amount calculates and outputs the tax payable. 2: Write a program (using a switch statement) that accepts one of the exam scores A, B, C, D, and E. In response, the program will output the corresponding percentage score, which is A: 90 100; B: 80 89; C: 70 79; D: 60 69; E: 0 59. 3: Write a program that can find a number between 0 and 100. The user decides on a number and the program repeatedly makes a guess and constantly narrows in on the number until the number is found. Hint: Let the computer guess on the number in the middle of the possible maximum number and the possible minimum number. For example, the first guess should be 50. If the user indicates the number to be greater, the next guess should be 75, and so on.

C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 286
Authors: Stephen Prata

Similar book on Amazon