Let us learn how to calculate simple interest in C programming language. We have enlisted two different methods to find simple interest and amount associated with it. The first method calculates simple interest without using function and the second method has a user – defined function to find the Simple Interest. Simple Interest Calculation of Savings Bank Accounts / Loan Accounts Following flowchart describes the process of simple interest calcu. Key generation in Simplified DES Simplified DES - Key Generation Simulation Program using C Programming DES means Data Encryption Standard.
Simple interest is calculated by, sinterest=principle*time*rate/100 formula.
This program will calculate the value of the SI where the principal, rate and the time is given by the user. So first of all, you have to include the stdio header file using the 'include' preceding # which tells that the header file needs to be process before compilation, hence named preprocessor directive. There is also another header file conio.h, which deals with console input/output and this library is used here for getch() function.
Then you have to define the main() function and it has been declared as an integer so by default it returns the integer. Inside the main() function you have to declare floating type variables name 'principle', 'rate', 'sinterest'; Moreover, you have to take another integer type variable name 'time'. Now, use printf() to display the message: 'Enter Principle Amount, Rate %% per Annum and Time'. Then the scanf() method is used which will take three values from the user and store it into variables - principal, rate and time.
Then according to the formula of simple inerest, the multiplicative value of all three i.e. (principal * rate * time) gets divided with 100.0 and is stored in the variable 'sinterest'.
Then all the four values i.e. principal, rate and time along with the calculated value of simple interest gets displayed using four printf() statements. The getch() reads a single byte character from input and getch() is a proper way to fetch a user inputted character.