Program to find simple interest in C

 

//Write a C program to find simple interest

#include<stdio.h> //header file name
int main()
{
    float p, r, t, si; //we are taking variables and assingning the data types that is float
   
   
    printf("Enter principal amount:") ; //taking input using printf() function
    scanf("%f", &p); //use scanf() function to assign above input value to the variable
   
   
  //Similarly do this

    printf("Enter rate of interest:") ;
    scanf("%f", &r);
   
    printf("Enter time:") ;
    scanf("%f",&t) ;
 
//Now you have to find simple interest using formula
   
    si=((p*r*t) /100)+p;
   
    printf("Simple interest is %f", si);
    return 0; //here your program is closed.
}

No comments:

Powered by Blogger.