Simple intrest
Title
Question
#include
i<stdio.h>nt main()</stdio.h>
<stdio.h> {</stdio.h>
<stdio.h> float principle, time, rate, SI; </stdio.h>
<stdio.h> printf("Enter principle (amount): "); </stdio.h>
<stdio.h> scanf("%f", &principle); </stdio.h>
<stdio.h> printf("Enter time: "); </stdio.h>
<stdio.h> scanf("%f", &time); </stdio.h>
<stdio.h> printf("Enter rate: ");</stdio.h>
<stdio.h> scanf("%f", &rate); </stdio.h>
<stdio.h> SI = (principle * time * rate) / 100; </stdio.h>
<stdio.h> printf("Simple Interest = %f", SI); </stdio.h>
<stdio.h> return 0; </stdio.h>
<stdio.h> }</stdio.h>
<stdio.h>
</stdio.h>
</stdio.h>
<stdio.h>
</stdio.h>
</stdio.h>
<stdio.h>
</stdio.h>
</stdio.h>
Gokulapriya
Ece department irtt
C-and-Cpp Tokens 06-07 min 40-50 sec
Answers:
something wrong in your editor. You are getting each and every line stdio.h. Refer the following C program, it is working:
#include<stdio.h>
int main()
{
<span style="white-space:pre"> </span>float principle, time, rate, SI;
<span style="white-space:pre"> </span>printf("Enter principle (amount): ");
<span style="white-space:pre"> </span>scanf("%f", &principle);
<span style="white-space:pre"> </span>printf("Enter time: ");
<span style="white-space:pre"> </span>scanf("%f", &time);
<span style="white-space:pre"> </span>printf("Enter rate: ");
<span style="white-space:pre"> </span>scanf("%f", &rate);
<span style="white-space:pre"> </span>SI = (principle * time * rate) / 100;
<span style="white-space:pre"> </span>printf("Simple Interest = %f", SI);
<span style="white-space:pre"> </span>return 0;
}
Result
C:\cygwin64\bin>gcc -o Simple_Interest Simple_Interest.c
C:\cygwin64\bin>Simple_Interest
Enter principle (amount): 20000
Enter time: 60
Enter rate: 12
Simple Interest = 144000.000000
#include <iostream>
using namespace std;
float solve( int P, int T, float R ) {
float si; si = (P * T * R) / 100;
return si;
} int main()
{ int P = 10000;
int T = 7; float R = 6.25;
cout << "Simple interest for 10,000 with ROI 6.25\% for 7 years is: ";
float result;
result = solve( P, T, R );
cout << result << endl;
cout << "Total amount is: " << P + result;
return 0;
}
<font size="4">Program in c to find simple interest:</font>
#include <stdio.h>
int main()
{
float p,t,r;
float si;
printf("Enter the value of principal,time and rate of interest:\n");
scanf("%f %f %f",&p,&t,&r);
si = (p*t*r)/100;
printf("Simple interest is %.2f",si);
return 0;
}
Output:
Enter the value of principal,time and rate of interest:
5000
2
7.5
Simple interest is 750.00
#include<stdio.h>
#include<conio.h>
int main()
{
float p,t,r;
double si;
printf("enter the principle :");
scanf("%f",&p);
printf("enter the time :");
scanf("%f",&t);
printf("enter the rate :");
scanf("%f",&r);
si=(p*t*r)/100;
printf("simple interest=%lf,si);
return 0;
}
output :
enter the principle : 5000
enter the time:2
enter the rate:5
simple interest =500.00000
#include<stdio.h>
#include<conio.h>
int main()
{
float p,t,r;
double si;
printf("enter the principle :");
scanf("%f",&p);
printf("enter the time :");
scanf("%f",&t);
printf("enter the rate :");
scanf("%f",&r);
si=(p*t*r)/100;
printf("simple interest=%lf,si);
return 0;
}
output :
enter the principle : 5000
enter the time:2
enter the rate:5
simple interest =500.00000
#include<stdio.h>
#include<conio.h>
int main()
{
float p,t,r;
double si;
printf("enter the principle:");
scanf("%f",&p);
printf("enter the time:");
scanf("%f",&t);
printf("enter the rate:");
scanf("%f",&r);
si=(p*t*r)/100;
printf("simple intrest=%lf,si);
return 0;
}
output:
enter the principle:10000
enter the time:2
enter the rate:5
simple intrest =1000
#include<stdio.h>
#include<conio.h>
int main()
{
float p,t,r;
double si;
printf("enter the principle:");
scanf("%f",&p);
printf("enter the time:");
scanf("%f",&t);
printf("enter the rate:");
scanf("%f",&r);
si=(p*t*r)/100;
printf("simple intrest=%lf,si);
return 0;
}
output:
enter the principle:20000
enter the time:2
enter the rate:5
simple intrest =2000
Login to add comment