Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple and Compound interest #12

Open
0759537471 opened this issue Oct 17, 2024 · 0 comments
Open

Simple and Compound interest #12

0759537471 opened this issue Oct 17, 2024 · 0 comments

Comments

@0759537471
Copy link

include <stdio.h>

int main() {
float principal, rate, time, simpleInt, compoundInt;

printf("Enter the principal amount: ");
scanf("%f", &principal);

printf("Enter the rate of interest: ");
scanf("%f", &rate);

printf("Enter the time period in years: ");
scanf("%f", &time);

// Calculate simple interest
simpleInt = (principal* rate*time)/100;

printf("calculate simple intrest:");


// Calculate compound interest
int n,
printf("Enter the number of times Intrest is compounded per year:");
scanf("%d",& n);

compoundInt =principal*power((1+rate/(n*100) ), (n*time) )- principal



// Display the results
printf("\nSimple Interest: %.2f\n", simpleInt);
printf("Compound Interest: %.2f\n", compoundInt);

return 0;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant