Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
0 of .
Results for:
P. 1
C5( if and for loop)

# C5( if and for loop)

Ratings: (0)|Views: 1,145|Likes:

### Availability:

See more
See less

08/23/2012

pdf

text

original

List of Programs
a)
Ramesh’s basic salary is input through the keyboard. His dearnessallowance is 40% of basic salary, and house rent allowance is 20% of basicsalary. Write a program to calculate his gross salary.Gross Salary=Basic Salary + HRA+ DA
b)
The distance between two cities (in km.) is input through the keyboard.Write a program to convert and print this distance in meters, feet, inchesand centimeters.
c)
If the marks obtained by a student in five different subjects are input tthrough the keyboard, find out the aggregate marks and percentagemarks obtained by the student. Assume that the maximum marks thatcan be obtained by a student in each subject is 100. d) Temperature of a city in Fahrenheit degrees is input through the keyboard.Write a program to convert this temperature into Centigrade degrees.(e) The length & breadth of a rectangle and radius of a circle are input throughthe keyboard. Write a program to calculate the area & perimeter of the rectangle,and the area & circumference of the circle.(f) Two numbers are input through the keyboard into two locations C and D.Write a program to interchange the contents of C and D.(g) If a five-digit number is input through the keyboard, write a program tocalculate the sum of its digits.(Hint: Use the modulus operator ‘%’)(h) If a five-digit number is input through the keyboard, write a program toreverse the number.(i) If a four-digit number is input through the keyboard, write a program toobtain the sum of the first and last digit of this number.(j) In a town, the percentage of men is 52. The percentage of total literacy is 48. Iftotal percentage of literate men is 35 of the total population, write a program tofind the total number of illiterate men and women if the population of the townis 80,000.

(k) A cashier has currency notes of denominations 10, 50 and 100. If the amountto be withdrawn is input through the keyboard in hundreds, find the totalnumber of currency notes of each denomination the cashier will have to give tothe withdrawer.(l) If the total selling price of 15 items and the total profit earned on them is inputthrough the keyboard, write a program to find the cost price of one item.(m) If a five-digit number is input through the keyboard, write a program toprint a new number by adding one to each of its digits. For example if thenumber that is input is 12391 then the output should be displayed as 23402.n)Write a program to calculate overtime pay of 10 employees. Overtime is paidat the rate of Rs. 12.00 per hour for every hour worked above 40 hours. Assumethat employees do not work for fractional part of an hour.o)Write a program to find the factorial value of any number entered through thekeyboard.p)Two numbers are entered through the keyboard. Write a program to find thevalue of one number raised to the power of another.q)Write a program to print all the ASCII values and their equivalent charactersusing a
while
loop. The ASCII values vary from 0 to 255.r)Write a program to print out all Armstrong numbers between 1 and 500. If sumof cubes of each digit of the number is equal to the number itself, then thenumber is called an Armstrong number. For example, 153 = ( 1 * 1 * 1 ) + ( 5 * 5* 5 ) + ( 3 * 3 * 3 )s)Write a program to enter the numbers till the user wants and at the end itshould display the count of positive, negative and zeros entered.t)Write a program to find the octal equivalent of the entered number.( hint : Octal: first convert the number to binary and then Split the number intogroups of 3 i.e. 1 111 101 Now convert each group immediately into one Octaldigit, i.e. 1 becomes 1, 111 becomes 7, 101 becomes 5.So %1111101 = @175 (@ is the prefix indicating an Octal number)u)Write a program to find the range of a set of numbers. Range is the differencebetween the smallest and biggest number in the list.