| 
//Write a Program to calculate Simple Interest in Java. 
import
  java.io.*; 
class
  sum 
public
  static void main(String args[]) 
{ 
int
  p,r,t,si; 
p=100; 
r=10; 
t=10; 
si=
  (p*r*t)/100; 
System.out.print(“The
  Simple Interest is  =”+si); 
} 
} 
Output: 
The
  Simple Interest is  =100 | 
| 
//Write
  a Program to calculate Simple Interest in Java Using Scanner Class 
import
  java.io.*; 
import
  java.util.*;  
class
  sum 
public
  static void main(String args[]) 
{ 
int
  p,r,t,si; 
Scanner
  obj=new Scanner(System.in); 
System.out.println(“Enter
  the Value of Principle \n”); 
p=obj.nextInt(); 
System.out.println(“Enter
  the Value of Rate of Interest  \n”); 
r=obj.nextInt(); 
System.out.println(“Enter
  the Value of Time \n”); 
t=obj.nextInt(); 
si=
  (p*r*t)/100; 
System.out.println(“\n
  The Simple Interest is  =”+si); 
} 
} 
Output: 
The
  Simple Interest is  =100 | 


 
 
 

Hlo
ReplyDelete