19 : C Program to Compute Simple Interest (SI)

Check out the complete list of c-programs : C Program List    



In order to calculate Simple Interest you need to know Principle Amount, Rate and Duration values. You need to get these values from user using scanf fuction.

Variables :

1. principle : (Datatype int) : to hold principle amount entered by user.

1. rate : (Datatype int) : to hold rate entered by user.

1. duration : (Datatype int) : to hold duration entered by user.

2. simpleInterest : (Datatype fload) : To hold Simple Interest calculated



Formula :

SI = (Principle x Rate x Duration)/100



Functions :

printf() : is used to display something on the console/screen. Format specifier %d in printf function is used to display a int variable on screen. \n is used to add a newline

scanf() : is used to fetch data inputted by the user on the console/screen using keyboard. %d in scanf is indicates that inputted text is of type int.








/*
 * 1000+ C programs + tutorials
 *
 * 
 * 19_compute_simple_interest.c
 *
 *
 *  Created on: Oct 20, 2014
 *  Author: Code2care.org
 */

#include 
//#include 

void main() {

  int principle;
  int rate;
  int duration;
  float simpleInterest;

//	clrscr();

	printf(" Simple Interest Calcuation :  ");

	printf("\n\n Enter Principle Amount : ");
	scanf("%d", &principle);
    
    printf("\n\n Enter Rate of Interest : ");
	scanf("%d", &rate);
    
    printf("\n\n Enter Duration : ");
    scanf("%d", &duration);
    
    simpleInterest = (principle*duration*rate)/100;
    
    printf("\n\nSimple Interest :  %lf  \n",simpleInterest);


  
//	getch();


}


  • Output :

      Simple Interest Calcuation : 10000

      Enter Principle Amount : 5

      Enter Rate of Interest : 10

      Enter Duration :

      Simple Interest : 5000.000000







The best way to learn C programming is to practice more and more of programs . Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.

BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.