Programming Tasks, computer in education, computer learning, free computer courses., learn computer through web






Programming Tasks


1.       Write a program that reads in the radius (r) of a circle and prints its diameter (2r), circumference (2Ï€r) and area (Ï€r2).
2.       Write a program that takes temperature in Fahrenheit and converts it into Celsius.
3.       Write a program that takes a number form the user and prints weather it is even or odd.
4.       Write a program that takes two numbers form the user, determines and prints weather first is multiple of second or not.
5.       Write a program, which takes age of the user in years and prints in months, days and hours.
6.       Write a program that takes age of the user in years and prints the number of times his heart beats. (Human heart beats on the average of once a second)
7.       Write a program that takes the length and width of a rectangular yard and the length and width of a rectangular house situated in the yard. Your program should compute the time required to cut the grass at the rate of two square feet a second.
8.       Write a program to compute the rate of growth, expressed as percentage, of an insect population. Take as input the initial size of the population and its size one week later. Then predict the size of population for next week, assuming that growth continues at the same rate.
9.        Raheem the Worker always works 52 hours a week. He earns Rs. 900 for the first 40 hours he works. He gets time and a half (1.5 times his regular hourly pay) for the first 10 hours over 40. He gets double time for all hours over 50. He is in the 8 percent tax bracket. Write a program with appropriate titles that prints Raheem’s gross pay, net pay, and taxes.
10.    Write a program that asks the user to enter two integers. Obtain the numbers from the user. Then prints the larger number followed by the word “is larger ”. If the numbers are equal, print the message “These numbers are equal”.
11.    Write a program that inputs three integers from the keyboard, and prints smallest and largest of these.
12.    Write a program that takes the x - y coordinates of a point in the Cartesian plane and prints a message telling either an axis on which the point lays or the quadrant in which it is found.
Sample lines of output
Enter x and y coordinates
-1
-2.5
(-1, -2.5) is in quadrant III.
13.    Write a program that takes two numbers from the user and prints the squares of all the numbers between them.
14.    Write a program that takes two letters from the user and prints all letters between them.
15.    Factorial of a nonnegative integer n is written as n! (pronounced as “n factorial”) and is defined as follows:
n! = n . (n – 1) . (n – 2) . …… .1        or            (product of all positive integers from n to 1)
n! = 1  (for n = 0)                 for example ,        5! =  5 . 4 . 3 . 2 . 1
Write a program that reads a nonnegative integer and prints its factorial.
16.    Write a program that calculates the product of all even integers form 1 to 15.
17.    Write a number-guessing game. Store an integer (from 1 to 100) in a variable. Ask the user to guess the number between 1 and 100. If he doesn't guess the value, give him a clue (his guessed value is higher or lower then stored value) and ask for guess again. If he guesses the variable's value correct, congratulate him and print the total number of guesses he made (score of the user). If the user enters 0, stop the program.
18.    The Fibonacci sequence is a sequence of numbers beginning 1, 1, 2, 3, 5, 8, 13, 21…. First two elements are defined to be 1; each of other element is the sum of its two predecessors. Write a program that takes first 25 elements of Fibonacci sequence.
19.    Write a program that will find the smallest, largest, and average values in a collection of N data values. Get the value of N before taking input of data values from the user.
20.    Modify the program 19 to compute the standard deviation, accumulate the sum of squares of the data values (sum_squares) and use the formula as follows:

Standard Deviation  =  ( ( sum_squares / N ) – Average) 1/2