A shorcut to learn C language

WAP TO CALCULATE SIMPLE INTEREST :-
It is the short and simple method to calculate the simple interest ,here clrscr(); is used for to clear the screen and getch(); is used for to hold the out on the screen.



#include<stdio.h>
#include<conio.h>
void main()
{
int p,t;
float r,si;
clrscr();  //To clear screen.
printf(" \t\tFIND SIMPLE INEREST");
printf("\nenter the principal p=");
scanf("%d",&p);
printf("\nenter the value of time t=");
scanf("%d",&t);
printf("\nenter the value of rate r=");
scanf("%f",&r); // Read value from keyboard
si=p*t*r/100;
printf("\n\tsimple interest=%f",si);
getch(); //To hold output on the screen.
}

O/P:- FIND SIMPLE INEREST

enter the principal P= 1000
enter the value of time t= 2
enter the value of rate r= 2
simple interest= 40

Back 

No comments:

Post a Comment