C Language program to calculate interest

Views: 150   

Following program shows you how to calculate interest.
In this program we get investment, interest rate and time from user and calculate interest using following formula
Interest = investment X interestRate X time / 100

#include <stdio.h>
int main() {
    int investment;
    int interestRate;
    int time;

    printf("Enter investment:");
    scanf("%d", &investment);

    printf("Enter interest rate:");
    scanf("%d", &interestRate);

    printf("Enter number of years:");
    scanf("%d", &time);

    int interest = investment * interestRate * time / 100;

    printf("Interest amount is: %d", interest);


Enter investment: 10000
Enter interest rate: 24
Enter number of years: 3
Interest amount is: 7200
On By