int main()
{
int p,n,count;
float r,si;
count=1;
while(count<=3)
{
printf("\n enter values of p,n,andr");
scanf("%d %d %f",&p, &n, &r);
si=(float)p * (float)n * r / 100;
printf("simple interest =rs. %f",si);
count=count+1;
}
return(0);
}
Nishant:this will give S.I...
-----------------------------------------------------------------------------------------------------
//mycfiles.wordpress.com
//Program for Calculate Simple Interest
#include<stdio.h>
#include<conio.h>
void main()
{
float p,r,n,si;
clrscr();
printf("\nEnter the profit, rate & no of yr\n\n ");
scanf("f%f",&p,&r,&n);
si=(p*r*n)/100;
printf("\nSimple Intrest=%f",si);
getch();
}
public double calculateSimpleInterest(double principal, int years, double rate){
double interest = 0;
interest = (principal * years * rate)/100;
return interest;
}
The above method will take the principal, rate of interest and no. of years and calculates the simple interest and returns the value.
this is an java program,only for calculating simple interest
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
/*
<applet code="simin" width=300 height=50>
</applet>
*/
public class simin extends Applet implements ActionListener {
// Three text fields:
TextField principalField, rateField, numYearsField;
// Variables we will need:
double simpleInterest = 0;
double amount = 0;
double principal = 0;
double numYears = 0;
double rate = 0;
public void init()
{
// Create the textfields, labels and button.
principalField = new TextField (6);
rateField = new TextField (6);
numYearsField = new TextField (6);
Label principalLabel = new Label ("Principal ");
Label rateLabel = new Label ("Rate (%) ");
Label numYearsLabel = new Label ("Time (in years) ");
Button calcButton = new Button ("Calculate");
// Lay out the components.
add (principalLabel);
add (principalField);
add (rateLabel);
add (rateField);
add (numYearsLabel);
add (numYearsField);
add (calcButton);
// Add the applet as listener to the calc button so that
// actionPerformed (below) is called when the button is clicked.
calcButton.addActionListener (this);
}
public void actionPerformed (ActionEvent e)
{
// First, let's work with the principal. Start
// by getting the string from the textfield:
String principalString = principalField.getText ();
// Remove whitespace on either end:
principalString = principalString.trim ();
// Now extract the value and assign it to our double variable:
principal = Double.parseDouble (principalString);
// Ditto for numYears:
String numYearsString = numYearsField.getText ();
numYearsString = numYearsString.trim ();
numYears = Double.parseDouble (numYearsString);
// Let's illustrate a shortcut that may be a little hard to understand:
rate = Double.parseDouble (rateField.getText().trim());
// Calculate the simple interest:
simpleInterest = (principal * rate * numYears) / 100;
amount = principal + simpleInterest;
// Redraw
repaint();
}
public void paint (Graphics g)
{
// Display the simple interest and amount:
g.drawString ("The simple interest and amount after " + numYears + " years", 60,100);
g.drawString (" Simple Interest: " + simpleInterest, 60,120);
g.drawString (" Total amount: " + amount, 60,140);
}
}
#include<stdio.h>
void main()
{
int si,p,t;
float r;
printf("enter the value of p,t,r");
scanf("%d%d%f",&P,&t,&r);
si=p*t*r/100;
printf("%d",si);
return(0);
}
Hi..
well to cal simple interest.. here is the prg..
for DLL:
Public Function si(ByVal p As Double, ByVal r As Double, ByVal t As Double) As Double
si = p * t * r / 100
End Function
for FORM:
Private Sub cmdsi_Click()
dim x as double
p = Val(Text1.Text)
t = Val(Text2.Text)
r = Val(Text3.Text)
x = s1.si(p, t, r)
Text1.Text = x
End Sub
Implement this method:
public static int computeInterest(int capital, int interestRate, int time) {
return captial * interestRate * time / 100;
}
The capital and interest rate should be multiplied by 100 before being passed in to allow for the use of integer operations. This will keep precision to a maximum. The answer passed back will also be in pennies.
Before one can write a Java script program for simple interest calculation, you will have to familiarize yourself with the process. First you will have to determine the language you will be using, this can be either compiled or interpreted. You will then have to decide whether your program will be server side script, or server side script. You will need a web browser and a text editor. You can then begin writing your code.
P = principal: T = time in years: R = interest rate percent
Input P , T, R
Interest = (P*T*R)/100
write a program in c to calculate simple interest for 5 years
Reference:cprogramming-bd.com/c_page1.aspx#simpleinterest
you can use strstr()
n1=val(text1.text) n2=val(text2.text) n3=val(text3.text) text4.text=(n1*n2*n3)/100
you can find a sample paper with the brochur. That was the oly guide line we had.
hey..it s simple..make use of built-in function isdigit(character)..it s in stdlib.h...
If you are working on simple interest you have to write the equation I=p. r.t
Reference:cprogramming-bd.com/c_page1.aspx#simpleinterest
There are many simple interest calculators online that you can find. I found the one at http://easycalculation.com/simple-interest.php to be simple and accurate.
the formula for simple interest is I=PRT (interest=principal x rate x time )
you can use strstr()
time(t)= interest/rate , princaple
find the interest on $4000 at 3.5% annual interest for 1 year 6 months
Multiply together the capital, the interest rate (as a fraction) and the number of periods to find out the interest.
The answer depends on what information you do have.
If you are looking for an online simple interest calculator there are several sites that you can find this on. One site where you can is called Easy Calculation and will give you all the tools you need.
simple interst is when you earn interest from your principal but compound interest is when you earn interest from your principal as well as from your previous interest
P*r*t divided by 100