Tuesday 25 September 2012

Function003

Write a function to input amount, rate, time and print simple interest.

#include <stdio.h>
#include <conio.h>
float       interest ( float, float, float );                /* Function prototype declaration */
void main ( )
{     
        float       amt, rat, tim;
        float       sud;
        clrscr ( );
                            
        printf("\n\n\t\t Enter amount.............:"); scanf("%f", &amt);
        printf("\n\n\t\t Enter rate of interest...:"); scanf("%f", &rat);
        printf("\n\n\t\t Enter time duration......:"); scanf("%f", &tim);
                                
        sud = interest ( amt, rat, tim );                       /* Function calling */
                                                         
        printf("\n\n\t\t INTEREST = % .2f", sud);
        getch ( );
}                         
                            
float  interest ( float    x, float    y, float    z )           /* Function Definition */
{                               
        float       w;
        w = ( x * z ) * y / 100.0;
        return ( w );
}
Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...