0% found this document useful (0 votes)
2 views2 pages

C Programming Ex1

The document outlines a C program designed to calculate simple and compound interest. It includes an algorithm detailing the steps to read input values for principal amount, duration, and interest rate, followed by calculations and output of the results. The program was successfully executed, demonstrating its functionality.

Uploaded by

Malathi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

C Programming Ex1

The document outlines a C program designed to calculate simple and compound interest. It includes an algorithm detailing the steps to read input values for principal amount, duration, and interest rate, followed by calculations and output of the results. The program was successfully executed, demonstrating its functionality.

Uploaded by

Malathi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

EX.

NO: 1 SIMPLE INTEREST AND COMPOUND INTEREST


DATE:

AIM
To write C program to calculate simple interest and compound interest.

ALGORITHM

 Start
 Read Principal Amount(p), No. of years(n) and Rate of Interest(r)
 Calculate Simple Interest using formula SI=(p*n*r)/100;
 Calculate Compound Interest using formula
ci = p * (pow(1 + r / 100, n) - 1);

 Print Simple Interest and Compound Interest


 Stop
PROGRAM:

#include <stdio.h>
#include <math.h>
#include <conio.h>
void main()
{
float p, t, r, si, ci;
clrscr();

printf("Enter principal amount (p): ");


scanf("%f", &p);

printf("Enter duration in years (n): ");


scanf("%f", &n);

printf("Enter rate of Interest (r): ");


scanf("%f", &r);
si = (p * n * r) / 100.0;
ci = p * (pow(1 + r / 100, n) - 1);

printf("\n Simple Interest = %.2f ", si);


printf("\n Compound Interest = %.2f ", ci);

getch();
}

Result:

Thus, the C program to calculate simple interest and compound interest was
executed successfully.

You might also like