Write a C program to compute:§ (a) Simple Interest, S.I = Principal*Rate*Time/100§ (b) Compound Interest C.I = P(1+(r/n))nt25
Question
Write a C program to compute:§ (a) Simple Interest, S.I = PrincipalRateTime/100§ (b) Compound Interest C.I = P(1+(r/n))nt25
Solution
Sure, here is a simple C program to calculate both Simple Interest and Compound Interest:
#include<stdio.h>
#include<math.h>
int main() {
float principal, rate, time, simple_interest, compound_interest;
int n;
printf("Enter the principal amount: ");
scanf("%f", &principal);
printf("Enter the rate of interest: ");
scanf("%f", &rate);
printf("Enter the time in years: ");
scanf("%f", &time);
printf("Enter the number of times interest applied per time period: ");
scanf("%d", &n);
// calculate simple interest
simple_interest = (principal * rate * time) / 100;
printf("Simple Interest = %.2f\n", simple_interest);
// calculate compound interest
compound_interest = principal * (pow((1 + rate / (n*100)), n*time));
printf("Compound Interest = %.2f\n", compound_interest);
return 0;
}
This program first takes the principal amount, rate of interest, time in years, and the number of times interest is applied per time period as input from the user. It then calculates the simple interest using the formula S.I = Principal*Rate*Time/100 and the compound interest using the formula C.I = P(1+(r/n))nt. The calculated simple interest and compound interest are then printed to the console.
Similar Questions
Exercise 6Write a C program to compute:§ (a) Simple Interest, S.I = Principal*Rate*Time/100§ (b) Compound Interest C.I = P(1+(r/n))nt25Exercise 7Writing a C program generate for the results of the followingequations by given the values A = 12, B = 3, C = 6, D = 2:1. F = A + B/C - D ^22. F = (A + B)/ C - D ^23. F = A + B/(C - D ^ 2)4. F = (A + B)\ D ^ 226Exercise 8:Roger would like to know the average of his test scores.§ Write an equation that would calculate the average givenfive (5) test scores.§ Write a C program to solve this problem.27Exercise 928§ Write a complete C program for each of the following problem situations. Enter eachprogram into the computer, being sure to correct any typing errors. When you are sure thatit has been entered correctly, save the program, then compile and execute. Be sure toinclude prompts for all input data, and label all output.– Print HELLO! at the beginning of a line.– Have the computer print• HI, WHAT’S YOUR NAME? on one line. The user then enters his or her nameimmediately after the question mark. The computer then skips two lines and printsWELCOME (name) LET’S BE FRIENDS! on two consecutive lines. Use acharacter-type array to represent the user’s name. Assume the name contains fewerthan 20 characters.Exercise 10§ Write a C program to convert a temperature reading indegrees Fahrenheit (0F) to degrees Celsius (0C), usingthe formula,§ C = (5/9)x (F- 32).§ Test the program with the following values: 68,150,212,0, -22, -200 (degrees Fahrenheit).29Exercise 11Write a C program to calculate the volume and area of a sphere usingthe formulas:V = 4𝝅𝒓𝟐/𝟑,A = 4𝝅𝒓𝟐Test the program using the following values for the radius,r = 1, 6, 12.2, 0.2.30Exercise 1231§ Write a C program which reads a set of k integers(x1, x2, x3, …xn) from the keyboard and computethe harmonic mean.𝑴𝒆𝒂𝒏 = 𝒌𝟏𝒙𝟏 + 𝟏𝒙𝟐 , . . . , 𝟏𝒙𝒏Exercise 13§ Write a C program that accepts an employee's ID, totalworked hours of a month and the amount he received perhour.§ Print the employee's ID and salary (with two decimalplaces) of a particular month.32Exercise 14§ Write a C program that accepts the weights valuesof two items (floating points' values ) and numberof purchase (floating points' values) and calculatethe average value of the items.33Exercise 15§ Write a C program that accepts two integersfrom the user and calculate the sum andproduct of the two integer
Implement a program to calculate the Simple Interest by using the formula given below and display the calculated Simple Interest.Simple Interest = (principal*rate of interest*time)/100
Calculate the simple interest earned. Round to the nearest cent.P = $4550, r = 6%, t = 1 year
1. The rate is given as a percent (%). Before using it in the simple interest formula, you must first convert it to a______.
Use the formula for continuously compounded interest, A = Pert, to find the annual interest rate for an $8000 investment that earns $410.17 in one year.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.