Wednesday, 23 April 2014

1. Develop algorithm, Flowchart: and write an interactive program to calculate simple Interest and compound interest



#include<stdio.h>
#include<conio.h>

void main()
{
          float pri,amt,rate,si,ci,time,interest,i,j=1;
          clrscr();
          printf("\n\n\t\tEnter the principle -> ");
          scanf("%f",&pri);
          printf("\n\n\t\tEnter the rate -> ");
          scanf("%f",&rate);
          printf("\n\n\t\tEnter the time In Year -> ");
          scanf("%f",&time);

          // -------Program For Simple Interest---------

          interest=(pri*rate*time)/100;
          si=pri+interest;
          printf("\n\n\t\tYour Interest is %f",interest);
          printf("\n\n\t\tYour Simple Interest is %f",si);

          // ------Program For Compound Interest--------

          for(i=1; i<=time; i++)
          {
                   j=(rate+100)/100*j;
          }
          ci=pri*j;
          interest=ci-pri;
          printf("\n\n\t\tYour Interest in Compound is %f",interest);
          printf("\n\n\t\tYour Compound Interest is %f",ci);
          getch();
}

No comments:

Post a Comment