0% found this document useful (0 votes)
8 views

Java Report No 3

Java programming

Uploaded by

mblack9999900
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)
8 views

Java Report No 3

Java programming

Uploaded by

mblack9999900
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
You are on page 1/ 3

cixÿY bsÑ03

cixÿ‡Yi bvg: Rvfv Acv‡iUi e¨envi Kivi †cÖvMÖvg|


Rvfv Acv‡iUi e¨envi K‡i †cÖvMÖvgmg~n
‡cÖvMÖvg bsÑ1: AvqZ‡ÿ‡Îi ‡ÿÎdj wbY©q Kivi ‡cÖvMÖvg|
import java.util.Scanner;
class Rectangle{
public static void main(String[]args){
Scanner sc= new Scanner(System.in);
System.out.print(“Enter The length:”);
int a= sc.nextlnt();
System.out.print(“Enter The width:”);
int b= sc.nextlnt();
int area=a*b;
System.out.println(“Rectangle area is ``+area);
}
}
‡cÖvMÖvg bsÑ2: eM©‡ÿ‡Îi ‡ÿÎdj wbY©‡qi ‡cÖvMÖvg|
import java.util.Scanner
class Square{
public static void main(String[]args) {
Scanner sc= new Scanner(System.in);
System.out.print(“Enter The length:”);
int a= sc.nextlnt();
double area=a*a;
System.out.println(Square area is ``+area);
}
}
‡cÖvMÖvg bsÑ3: If condition wbY©q Kivi ‡cÖvMÖvg|
import java.util.Scanner;
public class If ConditionExample {
public static void main(String[]args){
int number = 10;
if (number > 0) {
System.out.println(“The number is positive.”);
}else if (number < 0) {
System.out.println(“The number is negative.”);
}else{
System.out.println(“The number is 0.”);
}
}
}

You might also like