Simple interest calculation using C language | C language prectical | pps solution GTU

GTU PPS Practical-3

Question :

Write a program to calculate simple interest (i = (p*r*n)/100 )

i = Simple interest
p = 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 :

  1. START
  2. Input p,r,n.
  3. Calculate i (i = (p*r*n)/100)
  4. print i.
  5. 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.


THANK YOU

Post a Comment

0 Comments