C Online Compiler
Example: Simple Interest Program in C using Function
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// Simple Interest Program in C using Function #include <stdio.h> // This function will calculate the simple interest void CalcSimpleInterest(float x, float y, float z) { float SI; // value of the simple interest // It will calculate the value of simple interest SI = (x * y * z) / 100; // It will produce the final output printf("\nSimple Interest = %.2f\n", SI); } // It's the driver function int main() { float p, t, r; // `p` = principal, `t` = time, and `r` = rate printf("Enter the principal (amount), time, and rate::\n"); scanf("%f%f%f", &p, &t, &r); CalcSimpleInterest(p, t, r); return 0; }
5 7 9
Output
Clear
ADVERTISEMENTS