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