In the previous blog we saw how to square a number .Now, we will see how to calculate the simple interest in C.

Basic Data Type:- int, char, float, double

int Datatype:- Its an integer datatype .Its of 2 bytes .Its range is −32,768 to 32,767.

char Datatype:-Its an character datatype. Its of  1 byte. Its range is -128 to 127 .

float Datatype:-Its for floating point numbers. Its of  4 byte.

double Datatype :-Its for large floating point numbers .Its of 8 byte.

How to calculate simple interest .

#include <stdio.h>

int main()

{

  float amount,rate,si;

  int time;

  printf("Enter the amount ,rate and time to calculate simple interest ");

  scanf("%f %f %d",&amount,&rate,&time);

  si=(amount*rate*time)/100;

  printf("Simple interest value is %f ",si);

}

Algorithm:-

1.Start 
2.Use the datatypes float to declare the variables amount,rate,si and int datatype to declare a variable time .
3.Use the scanf statement to get the input values by using the respective format specifiers for float and int as %f and %d for amout,rate and time .
4.Use the simple interest formula to calculate the value .
Explanation:-Formula is p*n*r/100
5.Finally print the "Simple interest value is" by using the format specifier as si .
6.Stop 

Screenshot:-
1.Code Screenshot:-


2.Output screenshot:-




In the next blog, we will see how to reverse a number in C.