Simple interest

Simple and compound interest by using SWITCH in C

#include<stdio.h> #include<conio.h> #include<math.h> void main() { int p,r,t,option; float result; clrscr(); printf(“PRINCIPAL, TIME & RATE\n”); scanf(“%d%d%d”,&p,&t,&r); printf(“Enter 1 for SI, 2 for CI\n”); scanf(“%d”,&option); switch(option) { case 1:result=(p*t*r)/100.0; break; case 2:result=p*pow(1+r/100.0,t)-p; break; } printf(“Interest=%f”,result); getch(); } After Running Program- 🙂

Simple Interest Compound interest by using C

#include<stdio.h> #include<conio.h> #include<math.h> void main() { int p,t; float r,si,ci; clrscr(); printf(“enter the value\n principle\n time\n rate\n”); scanf(“%d%d%f”,&p,&t,&r); /*formula of the simple interest and compound interest*/ si=p*r*t/100.0; ci=p*pow(1+r/100.0,t)-p; printf(“Simple interest=%0.1f\n”,si); printf(“compound interest=%0.1f”,ci); getch(); } After running program-