C Programming - Ch: 007 - Receiving Inputs in C

preview_player
Показать описание


In the previous chapter, we created a simple interest calculator, with fixed values. Every time you run the program, you get the same value for simple interest. If we wanted to calculate the simple interest for a different set of values, then we had to make changes to the code and recompile it.

If a program has to be useful to others, then it should ask them to enter the values using their keyboard and calculate the simple interest for the user supplied values.

So far in this course, you have learned to send output to the computer's screen by printing data using printf() function. Let me show you how to receive input from the users using scanf() function.

In this chapter, let us enhance our simple interest calculator program by allowing the user to key in Principle amount, number of years and rate of interest.
Рекомендации по теме
visit shbcf.ru