P010.c (614B)
1 /* WAP to find and display the difference 2 between compound Interest and Simple Interest. 3 Take principle amount as input. 4 Hint : si = (p * r * t) / 100 5 a = p * ((1 + (r / 100)) ^ t) 6 ci = a - p 7 */ 8 9 #include<stdio.h> 10 #include<math.h> 11 int main() { 12 double p, r, t, si, a, ci, dif; 13 printf("Enter the principle amount, rate of interest, time in year : "); 14 scanf("%lf %lf %lf", &p, &r, &t); 15 si = (p * r * t) / 100; 16 a = p * pow((1 + (r / 100)), t); 17 ci = a - p; 18 dif = ci - si; 19 printf("\nSimple Interest : %lf" 20 "\nCompound Interest : %lf" 21 "\nInterest Difference : %lf", si, ci, dif); 22 return 0; 23 }