Write a program to demonstrate function with argument and return value in c
#include<stdio.h>
#include<conio.h>
void main()
{
float simple(float,float,float);
float p,t,r;
clrscr();
printf("Enter the principal, time and rate of
interest:\n");
scanf("%f%f%f",&p,&t,&r);
printf("Simple interest=%f",simple(p,t,r));
getch();
}
float simple(float p,float t,float r)
{
return(p*t*r/100);
}
Output:
Enter the principal, time and rate of interest:
2000
2
5
No comments: