In this C program we will find the simple interest. In this program we will use four variables as prin,rate,time and si for simple interest.
C program code
#include<stdio.h>
#include<conio.h>
void main()
{
float prin,rate,time,si;
clrscr();
printf("\n Enter the value of principle=");
scanf("%f",&prin);
printf("\n Enter the value of rate=");
scanf("%f",&rate);
printf("\n Enter the value of time=");
scanf("%f",&time);
si=(prin*rate*time)/100;
printf("\n The value of simple interest is=%f",si);
getch();
}
Output 1:
Output 2:
we will find the simple interest. In this program we will use four variables as prin,rate,time and si for simple interest.we will use three variables for principle,rate and time and one variables for simple interest's value.
Solution
- In this program we will use three variables for principle,rate and time and one variables for simple interest's value.
- We declared these variables in float data type.
- Then we will enter the value of principle, rate and time.
- We use one logic for find the simple interest.Which are as... si=(prin*rate*time)/100;
- When we use this statement the value of these operations will be store in simple interest(si) variable.
- Then we will print the value of simple interest.
C program code
#include<stdio.h>
#include<conio.h>
void main()
{
float prin,rate,time,si;
clrscr();
printf("\n Enter the value of principle=");
scanf("%f",&prin);
printf("\n Enter the value of rate=");
scanf("%f",&rate);
printf("\n Enter the value of time=");
scanf("%f",&time);
si=(prin*rate*time)/100;
printf("\n The value of simple interest is=%f",si);
getch();
}
Output 1:
Output 2:
we will find the simple interest. In this program we will use four variables as prin,rate,time and si for simple interest.we will use three variables for principle,rate and time and one variables for simple interest's value.
No comments:
Post a Comment