C Online Compiler
Example: C Program to Calculate Simple Interest using Pointers
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C Program to Calculate Simple Interest using Pointers #include <stdio.h> int main() { float p, t, r, SI; // `p` = principal, `t` = time, and `r` = rate // `SI` = value of the simple interest float *x, *y, *z; // These are the pointer variables printf("Enter the principal (amount), time, and rate::\n"); scanf("%f%f%f", &p, &t, &r); x = &p; y = &t; z = &r; // 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); return 0; }
34 6 12
Output
Clear
ADVERTISEMENTS