C Programming

Solved Example

Practice Questions

Exercise Question

Calculate simple interest

#include<stdio.h>

int main() {
	int p,t;
	float r,si;
	
	printf("Enter principal,rate and time: ");
	scanf("%d%f%d",&p,&r,&t);
	
	si = p * t * r / 100;
	
	printf("Simple Interest = %.2f",si);
	
	return 0;
}

Sample Output:

Enter principal,rate and time: 10000 7.5 3
Simple Interest = 2250.00