GTU PPS Practical-3
Question :
Write a program to calculate simple interest (i = (p*r*n)/100 )
i = Simple interestp = Principal amount
r = Rate of interest
n = Number of years
Logic :
Logic is very simple for this program.
We only have to implement the formula to calculate the simple interest.
Let's look at the algorithm.
Algorithm :
- START
- Input p,r,n.
- Calculate i (i = (p*r*n)/100)
- print i.
- STOP
Code :
#include <stdio.h>
int main()
{
float i,p,r,n;
printf("Enter principal amount:");
scanf("%f", &p);
printf("Enter rate of interest:");
scanf("%f", &r);
printf("Enter number of years:");
scanf("%f", &n);
i = (p*r*n)/100 ;
printf("simple interest: %.2f", i);
return 0;
}
Output :
Here you can see output screen of the code. You can get this type of output if you write above code.
0 Comments
Donot make a spam in comment box.