Simple Interset with Using Function.
CODING:
#include<stdio.h>
#include<conio.h>
void main ()
{
float interest(float,float,int);
int year;
float amt,roi,total;
clrscr();
printf ("\nEnter the amount, rate of interest and years : ");
scanf ("%f %f %d",&amt,&roi,&year);
total=interest (amt,roi,year);
printf ("\n Total Amount =%g",total);
getche();
}
float interest ( float amt, float roi, int year)
{
float r=roi/100.00;
float t=r*amt*year;
printf ("\n Interest : %g",t);
amt=amt+t;
return amt;
}
OUTPUT:
Enter the amount, rate of interest and years : 1000 2 2
Interest: 40
Total Amount: 1040
CODING:
#include<stdio.h>
#include<conio.h>
void main ()
{
float interest(float,float,int);
int year;
float amt,roi,total;
clrscr();
printf ("\nEnter the amount, rate of interest and years : ");
scanf ("%f %f %d",&amt,&roi,&year);
total=interest (amt,roi,year);
printf ("\n Total Amount =%g",total);
getche();
}
float interest ( float amt, float roi, int year)
{
float r=roi/100.00;
float t=r*amt*year;
printf ("\n Interest : %g",t);
amt=amt+t;
return amt;
}
OUTPUT:
Enter the amount, rate of interest and years : 1000 2 2
Interest: 40
Total Amount: 1040
Comments
Post a Comment