Regarding Assignment
Title
Question
Why is the following code not running properly for calculation of simple interest?
<span style="background-color: rgb(250, 250, 250);">
</span>
</span>
<span style="background-color: rgb(250, 250, 250);">#include <stdio.h></span>
int main()
{
float principle=10000;
float rate=>2;
float time=2;
float SI;
SI = principle*rate*time/100;
printf(SI);
return 0;
}
C-and-Cpp Tokens 13-14 min 50-60 sec
Answers:
There is an issue in your printf statement. Please note that we use printf() function with a format specifier to display a variable's value. Thus, you need to replace your printf statement with the one given below:
printf("%f", SI);
#include <studio.h>
int main()
{
float p=2000;
float r=>3;
float t= 3;
float SI;
SI=(p*r*t)/100;
printf"the SI is %.2f : /n");
return 0;
}
#include <studio.h>
int main()
{
float p=2000;
float r=>3;
float t= 3;
float SI;
SI=(p*r*t)/100;
printf"the SI is %.2f : /n");
return 0;
}
Login to add comment