### C programme to find simple and compound interest

Write a C program to calculate simple and compound interest.

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

float p,q,r,SI,CI;

int n;

clrscr();

printf("Enter the value of Principal p = ");

scanf("%f \n",&p);

printf("Enter the value of Rate r = ");

scanf("%f \n",&r);

printf("Enter the value of Period n = ");

scanf("%d \n",&n);

SI = (p*r*n)/100;

printf("Simple Interest SI=%f \n",SI);

q = 1+(r/100);

CI=p*pow(q,n);

printf("Compound Interest CI=%f \n",CI);

getch();

}

#include<conio.h>

#include<math.h>

void main()

{

float p,q,r,SI,CI;

int n;

clrscr();

printf("Enter the value of Principal p = ");

scanf("%f \n",&p);

printf("Enter the value of Rate r = ");

scanf("%f \n",&r);

printf("Enter the value of Period n = ");

scanf("%d \n",&n);

SI = (p*r*n)/100;

printf("Simple Interest SI=%f \n",SI);

q = 1+(r/100);

CI=p*pow(q,n);

printf("Compound Interest CI=%f \n",CI);

getch();

}

## No comments:

## Post a Comment