C Program to Compute Simple Interest

Write a Program to Compute Simple Interest

// C Program to Compute Simple Interest

#include <stdio.h>

int main()
{
	int n, d;
	float r = 15,ans;

	printf("Enter Amount :--> ");
	scanf("%d", &n);

	printf("Enter Interest Rate :--> ");
	scanf("%f", &r);

	printf("Enter Duration (in months) :--> ");
	scanf("%d", &d);

	ans = (n * r * d) / 100;

	printf("\nSimple Interest :--> %0.2f", ans);

	return 0;
}

Output:

Enter Amount :--> 1000
Enter Interest Rate :--> 1.5
Enter Duration (in months) :--> 12

Simple Interest :--> 180.00

≪ Previous | Next ≫