In this example, we take user input and calculate simple interest.
#include <stdio.h>
int main()
{
float p , r , n , simple_interest ;
printf("Enter Principle Amount :: ");
scanf("%f",&p);
printf("Enter Interest Rate :: ");
scanf("%f",&r);
printf("Enter Year :: ");
scanf("%f",&n);
simple_interest = (p * r * n)/100;
printf("\n\n Simple Interest is : %.2f", simple_interest);
return (0);
}
Output :
Enter Principle Amount :: 100
Enter Interest Rate :: 10
Enter Year :: 2
Simple Interest is : 20.00
Ask anything about this examples