Search C Program

Calculate Simple Interest

/*    Calculate Simple interest    */
#include<stdio.h>
int main()
{
 float p;
 float ir,t;
 float in;

  printf("Type your principle amount : ");
  scanf("%f",&p);
  printf("\n Type your rate of intrest : ");
  scanf("%f",&ir);
  printf("\n Type time (in year) : ");
  scanf("%f",&t);
  in=p*ir*t/100;
  printf("\n You will get intrest : %.2f",in);
 return 0;
}

5 comments:

  1. your doc is very useful!!! Appreciate for the details about the C Programing. its very helpfull for learning a gud programing using C.
    Thanks for ur afferts Nimish.

    ReplyDelete
  2. printf("\n You will get intrest : %.2f",in);
    in this line y we using %.2f
    can u explain it

    ReplyDelete
    Replies
    1. it means that we will be showing 2 digits after decimal.

      Delete
  3. is that %.2f or %2f

    ReplyDelete