Saturday, October 22, 2011

a c program to calculate interest using stm ,sym ,ddm method

#include<stdio.h>
#include<conio.h>
void stm(float,int);
void ddm(float,int);
void sym(float,int);
void out_dis(float,float,int);
int main()
{
    int c,n;
    float p;
    printf("Press 1 for stm");
    scanf("%d",&c);
    printf("enter principle amount and year");
    scanf("%f%d",&p,&n);
    switch(c)
    {
     case 1:
          printf("Stm method");
          stm(p,n);
          break;
         
          }
          getch();
}
void stm(float x,int y)
{
int i;
float dep=x/y;
for(i=1;i<=y;i++)
{x=x-(dep);
out_dis(x,dep,i);
}
}
void out_dis(float x,float dep,int y)
{
     printf("\ny:%d    red:%f    cur :%f\n",y,dep,x);
     }

No comments:

Post a Comment