0% found this document useful (0 votes)
1 views5 pages

Java Programs Part 4

The document contains five simple Java programs with their objectives and successful execution results. The programs include a multiplication table, reverse number, swap numbers, simple interest calculation, and a basic 'Hello World' output. Each program is presented with its code and confirms successful execution.

Uploaded by

ramanji
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views5 pages

Java Programs Part 4

The document contains five simple Java programs with their objectives and successful execution results. The programs include a multiplication table, reverse number, swap numbers, simple interest calculation, and a basic 'Hello World' output. Each program is presented with its code and confirms successful execution.

Uploaded by

ramanji
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Simple Java Programs

Program 1: Multiplication Table


Objective: Write and execute the following Java program.
import [Link];
class Table{
public static void main(String args[]){
Scanner s=new Scanner([Link]);
int n=[Link]();
for(int i=1;i<=10;i++)
[Link](n+" x "+i+" = "+(n*i));
}
}
Result: The program was executed successfully.
Simple Java Programs
Program 2: Reverse Number
Objective: Write and execute the following Java program.
import [Link];
class Reverse{
public static void main(String args[]){
Scanner s=new Scanner([Link]);
int n=[Link](),r=0;
while(n>0){ r=r*10+n%10; n/=10; }
[Link](r);
}
}
Result: The program was executed successfully.
Simple Java Programs
Program 3: Swap Numbers
Objective: Write and execute the following Java program.
class Swap{
public static void main(String args[]){
int a=10,b=20,t;
t=a; a=b; b=t;
[Link](a+" "+b);
}
}
Result: The program was executed successfully.
Simple Java Programs
Program 4: Simple Interest
Objective: Write and execute the following Java program.
import [Link];
class Interest{
public static void main(String args[]){
Scanner s=new Scanner([Link]);
float p=[Link](),t=[Link](),r=[Link]();
[Link]((p*t*r)/100);
}
}
Result: The program was executed successfully.
Simple Java Programs
Program 5: Hello World
Objective: Write and execute the following Java program.
public class HelloWorld {
public static void main(String[] args) {
[Link]("Hello World");
}
}
Result: The program was executed successfully.

You might also like