write a program to calculate simple interest for specific value of p,r,t
Answers
Answered by
1
in c :
#include <stdio.h>
int main()
{
float principle, time, rate, SI;
printf("Enter principle (amount): ");
scanf("%f", &principle);
printf("Enter time: ");
scanf("%f", &time);
printf("Enter rate: ");
scanf("%f", &rate);
SI = (principle * time * rate) / 100;
printf("Simple Interest = %f", SI); return 0;
}
in java
import java.util.Scanner;
public class Simple_Interest
{
public static void main(String args[])
{
float p, r, t;
Scanner s = new Scanner(System.in);
System.out.print("Enter the Principal : ");
p = s.nextFloat();
System.out.print("Enter the Rate of interest : ");
r = s.nextFloat();
System.out.print("Enter the Time period : ");
t = s.nextFloat();
float si;
si = (r * t * p) / 100;
System.out.print("The Simple Interest is : " + si);
}
( don't consider the dots in the last few lines)
#include <stdio.h>
int main()
{
float principle, time, rate, SI;
printf("Enter principle (amount): ");
scanf("%f", &principle);
printf("Enter time: ");
scanf("%f", &time);
printf("Enter rate: ");
scanf("%f", &rate);
SI = (principle * time * rate) / 100;
printf("Simple Interest = %f", SI); return 0;
}
in java
import java.util.Scanner;
public class Simple_Interest
{
public static void main(String args[])
{
float p, r, t;
Scanner s = new Scanner(System.in);
System.out.print("Enter the Principal : ");
p = s.nextFloat();
System.out.print("Enter the Rate of interest : ");
r = s.nextFloat();
System.out.print("Enter the Time period : ");
t = s.nextFloat();
float si;
si = (r * t * p) / 100;
System.out.print("The Simple Interest is : " + si);
}
( don't consider the dots in the last few lines)
Similar questions