Friday, 21 November 2014

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);
            // -------Programm 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);

            // ------Programm 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

Please write your doubts