**Exercise 1 --- Area of a Circle**

Write a program that calculates the area of a circle from the radius. The radius will be an integer read in from the keyboard. You will need to use the function pi()

**Exercise 2 --- Cents to Dollars**

Write a program that reads in a number of cents. The program will write out the number of dollars and cents, like this:

Input the cents: 324 That is 3 dollars and 24 cents.

Review the modulo operator % if you are unsure how to proceed

When cashiers in a store give you change they try first try to "fit" dollars into the amount you get back, then try to "fit" quarters (25 cent coins) into what is left over, they try to "fit" dimes (10 cent coins) into what is now left over, then try to "fit" nickels (5 cent coins) into what is left, and finally are left with a few odd cents. For example, say that your change is 163 cents:

One dollar fits into 163, leaving 63 cents.

Two quarters fit into 63 cents, leaving 13 cents.

One dime fits into 13 cents, leaving 3 cents.

No nickels are needed.

Three cents are left.Your change is : 1 dollar, two quarters, one dime, and three cents.

Write a program that reads change due to a user (in cents) and writes out how many dollars, quarters, dimes, nickels, and pennies she is due. If you are stuck, it will help to do an example problem with paper and pencil.

Input the cents: 324 That is 3 dollars and 24 cents.

Review the modulo operator % if you are unsure how to proceed

**Exercise 3 --- Correct Change**When cashiers in a store give you change they try first try to "fit" dollars into the amount you get back, then try to "fit" quarters (25 cent coins) into what is left over, they try to "fit" dimes (10 cent coins) into what is now left over, then try to "fit" nickels (5 cent coins) into what is left, and finally are left with a few odd cents. For example, say that your change is 163 cents:

One dollar fits into 163, leaving 63 cents.

Two quarters fit into 63 cents, leaving 13 cents.

One dime fits into 13 cents, leaving 3 cents.

No nickels are needed.

Three cents are left.Your change is : 1 dollar, two quarters, one dime, and three cents.

Write a program that reads change due to a user (in cents) and writes out how many dollars, quarters, dimes, nickels, and pennies she is due. If you are stuck, it will help to do an example problem with paper and pencil.

Exercise 4 --- Ohm's Law

Ohm's law relates the resistance of a electrical device (like a heater) to the electric current flowing through the device and the voltage applied to it. The law is:

I = V/R

Here, V is the voltage (measured in volts), I is the current (measured in amps), and R is the resistance (measured in ohms.) Write a program that asks the user for the voltage and the resistance of a device. The program will then write out the current flowing through it.

Ohm's law relates the resistance of a electrical device (like a heater) to the electric current flowing through the device and the voltage applied to it. The law is:

I = V/R

Here, V is the voltage (measured in volts), I is the current (measured in amps), and R is the resistance (measured in ohms.) Write a program that asks the user for the voltage and the resistance of a device. The program will then write out the current flowing through it.

## 4 comments:

Nys Blog .....................................

For More programming exercises ,free e books and free projects visit this blog

programmingexercises

thanks for the problems!! awesome practice

This blog awesome and i learn a lot about programming from here.The best thing about this blog is that you doing from beginning to experts level.

Love from

Programming is very interesting and creative thing if you do it with love. Your blog code helps a lot to beginners to learn programming from basic to advance level. I really love this blog because I learn a lot from here and this process is still continuing.

Love from Pro Programmer

## Post a Comment