際際滷

際際滷Share a Scribd company logo
惘惷悋忰悋:惘惆悋 惆惺愕 悋愕
悋悴悋悋 惡愃悸 悋惘惡悴悸 悋愕悋愕悋惠
悋忰悋惷惘悴:悋惓悋惓忰
悋愆惘愀 悴(悋惘悋惘)
Conditional Statments
悋惘惡 悴悋惺悸/悋悽愕
悋惘惠惡悸 悸-悋悽愕/悋悽愕 愕
Out lines
金悋悴悋悋愃悸 悋愆惘愀悴惺惆悸
金悴悸if悋愆惘愀悸
金悴悸if悋惡愕愀悸
金悴悸 悋惺悋悋愆if悋惡愕愀悸
金悴悸 惠惷惺 惓悋if悋惡愕愀悸
金悴悸if悋慍惆悴悸
金悴悸 悋惺悋悋愆if悋慍惆悴悸
金悴悸 惠惷忰 惓悋if悋慍惆悴悸.
2
悋愆惘愀 悴Conditional Statments
悋リ惡惷愆:悋悵愕 惺惡
3
惘惺慍悴愆悴ル悋愆悋愕悋悋悴ル愃悽悋悴惡惡惓愆悽惡惶惡悽愃惡惆悋悴愆悴悽惓愆惺惡.
惘愃慍悽悵慍悋悴ル惺悵悋愆愃悴悽惘悴悋リ茄関悋惘悽惡惘愆悋愕惺惓惡悄惺愆愆愀忰悵惆
惓惺惷悋リ購細惡惆.
慍悋惘愃ル惓惡悴ル悋愆愆惺悽悋悴ル悋愆愆愀.
惘愆悴ル悋愆愆愀リ愆悴悋惡悽悋慍忰惺愆悋惺ル惡惆惡惷惺愆愆愀惆悋悽慍
悋悴ル悋慍悋悴ル:
悴ル悽if悋愆愆惺悽.
悴ル悽switch悋愆愆惺悽.
悴忰if悋愆惘愀忰
悋忰悋惷惘:悋悵惘 愕悋
4
惘惺慍悴愆悴ル悽if悋悴ル悋惘悽惡惘悋愆悋愕悋慍惘愃慍悽悵惓愆悋惺惺悋惺悵悵
悋慍愃悴惡惆悋悴愆悋悴.
惺悴惡愕忰惺悴ル悽惘忰慍惺愆愆愀惺惘慍悴慍悋惡惶惡悧悴悽(True)悋
悽惡惺悧悽(False)惓惡悄惺慍悋慍悴悽慍愃愆悋惘悴惡惺愆惘慍悋悴愆惡悴惡惘慍愃悴
悋忰惡悴悽悋悴愆惡悴.
ル慍惡惓悽悴ル悽悋愆愆愀if惆悋悽悋悴愆惡悴惓惺悵忰悋愆惡惘忰愃惠悋忰惡悴悽惡
悋悴愆惡悴:
悋悋-悴忰if悋惓愕愀忰:
悋忰悋惷惘:悋悵惘 愕悋
5
惘忰慍 悴ル 惺 惺悴惡愕忰 愃 愆愆愀悴悋悸 慍 惓悵悋慍惡  惺愆愆愀 慍悋
悋悴惡愆愆 悋愆愆愀 悴ル悽 惓惺悵 慍惠
悒惘悋慍悋 惘忰悋愆愆愀惓慍慍  悋リ茄関 惡悋悴ル悽悋愆愆愀 悴ル悽 惓惺悵 悋ル悴惆忰(悴悋悸
悋愆愆愀.)
悒惘悋慍 悋慍惡悽 悋悴ル 悋 慍 悋リ茄関 惡 悋愆愆愀 慍忰 惡悽 忰慍 惘慍悋 慍悋 悋悴ル悽
悋悴愆惡悴.
悴ル悽 惘慍惠 悋 ルif悋愆愆愀 悴悋悸 悋ル悽 悋悴ル 惺悵惆 忰愃惠 悋愆惡 惓惺悵忰 悋悴愃愃悽.
悋惺悋 悋愆惠悋惠忰悋惓愕愀忰 悋愆惘愀 悴忰
悋愆悋悋:惴 悋忰悵忰 悴ル悽   悋愆愆愀 悴悋悸 "悋忰悵 惺愃愆"慍惡惓悽 惘慍 悋忰惡悽 慍 
悴ル悽if悋慍惡 悋忰 惺:
1. if (Logical Condition) // 悋愆愆愀 悴ル悽+悋愆愆愀
2. Statment 1 // 悴悋悸悋愆愆愀
3. Next statement
愆惘悴惴惘慍悋悴ル悽悋慍惘悴ル悽悋愆愆愀悴惡愆愆忰(Statment 1)惓慍忰悋愆愆愀.
惡惘悋惡悵慍悴悽悋愆愆愀悋愃愃愆愕1惶惡悧悴悽True))愃慍惘慍悋悴ル悽悋慍惡悽悴ル悽悋愆愆愀
悋ル悴惆忰悋愃愃愆愕2惓慍悋悋惺慍リ関ж鰍惘慍惓悽悋悴ル.
悋惘悋惡悵慍悴悽悋愆愆愀悋愃愃愆愕1悽惡惺悧悽(False)愃慍惘悴惡惘慍悋悴ル悽悋慍惡悽悴ル悽悋愆愆愀
悋ル悴惆忰悋愃愃愆愕2忰惓慍悋悋慍惡悋惘慍惓悽悋悴ル悋慍惡悽惡悋惓慍悵悖悋愃愃愆愕3忰慍
惡悽悋悴愆惡悴.
6
悋忰悋惷惘:悋悵惘 愕悋
悋リ惡惷愆:悋悵愕 惺惡 7
悋悽悋惘慍忰
1-悋惓悵悋忰.
2-悋悵惘悴忰  悋愀悋悸 悋愕 悋惆悽
3-悵愕悋 悋  悋惓惘 悋悵惘悴忰 悋惆 悋惘悋50(50Grade>=)
1.3-忰 悋愀惓惺悋 悋悴忰pass
4-悋悋忰.
悵忰悋愕悖忰
悋惺愀悋悽:
(悋悵惘悴忰  悋愀悋悸 悋愕)
悋愀惡:
愀惓悋惺忰悋悴忰 忰悋惘悋悵愕悋 悋  悋惓惘 悋悵惘悴忰 悋惆50
悋惘惷悋悽:
悋 惘惷:
悋愀悋悸 悋愕:Name.
悋悵惘悴忰:Grade.
惓悋:惡愀惡悋惺惠  惠 惺莕 悋惆悸  惆惘悴惠 愀悋惡 悋愕 惡惘悋悄悸  惡惘リз悴 悋惠惡
惠"Pass"惠愕悋 悋  悋惡惘 悋悵惘悴惠 悋リ 悋惘悋50.
悋悴悋悋 惡愃惠 悋惡惘リз悴  悋悋リ岳悋惡 悋悽愀愀
悋リ惡惷愆:悋悵愕 惺惡
8
import java.util.Scanner;
public class First{
public static void main(String[] args){
Scanner input= new Scanner (System.in);
String name;
int grade;
name=input.next();
grade=input.nextInt();
if (grade>=50)
System.out.println( "Pass");
}
}
悋リ惡惷愆:悋悵愕 惺惡 9
悋惠 愀惡惺 惶忰忰 惺悵惆 惡惘悋悄悸  惡惘リз悴 悋惠惡even悋惠 慍悴 悋惺悵惆 悋 悒惘悋
odd愀惡惺 惘惆 悋惺悵惆 悋 悒惘悋Error愕悋 悋悵悽 悋惺悵惆 悋 悋惘悋0.
.1悋悴悵悋悽
.2悋惺悵惆 リ 悋惆悽num
.3惶悴 悋惺悵惆 惡悵 悋惘悋(num %2 =0)
1.3-悋惺悴惺リEven
.4愆惆 悋惺悵惆 惡悵 悋惘悋(num %2 =1)
1.4-リ 悋惺悴惺Odd
.5悋惶愆 惘愃惡 悋惺悵惆 リ 惡悵 悋惘悋(num=0)
1.5-リ 悋惺悴惺Erorr
.6悋惡悽
悋悴悋悋 惡愃惠 悋惡惘リз悴
悋リ惡惷愆:悋悵愕 惺惡
10
import java.util.Scanner;
public class First{
public static void main(String[] args){
Scanner input= new Scanner (System.in);
int x;
x=input.nextInt();
if (x % 2 ==0)
System.out.println( "Even");
if (x % 2 ==1)
System.out.println( "Odd");
if (x==0)
System.out.println( "Error");
}
}
悋愆悋惺悋惠悋惠忰悋愆惘愀 悴忰悋惓愕愀忰
悋忰悋惷惘:悋悵惘 愕悋
11
悋愆悋惓悋:悴悋悸悋愆愆愀悋惓愆悴ル悽悋忰悵忰"悋惓愆惺愃愆悋忰悵"慍
悋忰惡悽惘慍慍惡惓悽悴ル悽if惺悋忰悋慍惡:
1. if (Logical Condition) // 悋愆惘愀 悋惆悋悴+悋愆惘愀
2. {
3. statment1
4. statment2 // 悋愆惘愀 悴悋惡
5. .................n
6. }
7. next statement1 // 惠悋愆惘愀 惘悵惓愀忰 愃惘 悴忰
8. .........................n //
惓リ郊悋惺悵惡慍悴悋悸悋愆愆愀悋惓愆悴ル悽悴惠惷惺惡悴ル惺惡惓惺悋悧悽{ }慍
惘慍惡悽慍悋悴ル惺悵惘忰悋愆愆愀悋悽惡惶惓悴ル悽.if
悋悋惺愃愆  悋悴ル 惘慍 愆惘悴惴345愕 悋愃愃愆  悋愆愆愀 惓慍忰1
悋惘悋慍忰悋愆愆愀悋愃愃愆愕1惡悋慍慍慍悋悴惡愆愆悋悋愃愃愆愕7惓悋悋悋惺愃愆悋慍惡悽
悋惡悽悋悴愆惡悴.
惓悋:悋愕 惡愀惡悋惺惠  惠 惺莕 悋惆悸  惆惘悴惠 愀悋惡 悋愕 惡惘悋悄悸  惡惘リз悴 悋惠惡悋愀悋惡悋悵惘悴惠
惠"Pass"惠愕悋 悋  悋惡惘 悋悵惘悴惠 悋リ 悋惘悋50.
悋リ惡惷愆:悋悵愕 惺惡
12
import java.util.Scanner;
public class First{
public static void main(String[] args){
Scanner input= new Scanner (System.in);
String name;
int grade;
name=input.next();
grade=input.nextInt();
if (grade>=50)
{
System.out.println( "Name :"+ name);
System.out.println( "Grade="+grade);
System.out.println( "Pass");
}
}
}
惓悋悋:悴忰if悋慍惆悴忰
悋忰悋惷惘:悋悵惘 愕悋
13
惘愃慍悽悵慍悋悴ル悽惺悵悋愆愃悴悽惘悴悋リ茄関悒惘慍悋忰悵悴ル慍悋悋忰悵悴ル惺慍
悋悴ル惘惓惡悄惺悋愆愆愀悋ル悴惆悴ル悽悋愆愆愀.
慍悋惶惓惡惘悋悴ル慍悋悋リル惺慍(悋悴ル)惓リelse.
慍惘慍悋悴ル悽悋悴ル惺悽悋悴ル悽悋慍惘悴ル悽悋愆愆愀悋悴惡愆愆忰惡悽惘忰悋愆愆愀.
惓リ慍惘慍悋悴ル悽悋悴ル惺悽悋悴ル悋慍惘悴ル悽else忰惡悽惺悵惘忰悋愆愆愀.
惺愆悋惺惡忰悋惺慍悽悵悋悋悋悋悋愀{}悋忰惡悋惆悋慍惡悴悋悸悋愆愆愀惡悋惓愆
悴ル悽.
ル悋惘慍惠悴ル悽if悋リ禁悴悽惓惺悵忰悋愆惡惘忰愃惠惺悵惆悋悴ル悴悋悸悋愆愆愀.
悴忰 悋惺悋 悋愆if悋慍惆悴忰
悋忰悋惷惘:悋悵惘 愕悋
14
悋愆悋悋:忰惡悽惡惺悵惆悋悴ル悋リ細悸惘慍惡忰惡悽惘忰悋愆愆愀悴ル悽悋忰悵忰
惴.
悋愆愆愀 惘忰 惺悵 忰惡悽  惘慍惡 悋リ細悸 悋悴ル 惺悵惆 慍悴ル悽悋忰悵忰惴.
1. if (Logical Condition)
2. Statment1; // 悋愆愆愀 惘忰 忰惡悽  悋悴ル悽 慍 惘慍 慍
3. else
4. Statment1; //  悋悴ル悽 慍 惘慍 慍忰惡悽 惺悵悋愆愆愀 惘忰
5. next statement; // 悋愆愆愀 慍悴悽 惺 悋惴愆 惓愃惷 惘慍惡 惺慍 悋悴ル悽 慍
悋リ惡惷愆:悋悵愕 惺惡 15
惓悋:悋惠惡惡惘リз悴惡惘悋悄悸悋愕愀悋惡惆惘悴惠悋惆悸惺莕惠惡愀惡悋惺惠
惠"Pass &援顎看岳;悋惘悋盒潮盒朝悋リ盒潮盒朝悋悵惘悴惠盒潮盒朝悋惡惘盒潮盒朝盒潮盒朝悋盒潮盒朝惠愕悋盒潮50悋悋盒潮盒朝愀惡惺盒潮盒朝惠盒潮f温庄鉛
悴忰 悋惺悋 悋愆if悋慍惆悴忰
悋忰悋惷惘:悋悵惘 愕悋
16
惺悵惆 惡 忰惡悽 悋愆愆愀 惘忰 忰惡悽  惘慍惡 悋リ細悸 悋悴ル惘忰 惺悵 悋"悋忰悵忰 悴ル悽  悋惓愆"
惘慍惠悴ル悽if悋慍惡 悋忰 惺 悋リ禁悴悽:
1. if (Logical Condition)
2. {
3. Statment1;
4. Statment2; // 悋愆愆愀 惓慍忰 惘慍惡 愆惘悴惴 悴ル
5. }
6. Else
7. {
8. Statment1;
9. Statment2; // 愆惘悴惴 悴ル惓慍忰 惓惺悵 惘慍惡 悋愆愆愀
10. }
11. next statement; // 悋愆愆愀 慍悴悽 惺 悋惴愆 惓愃惷 惘慍惡 惺慍 悋悴ル悽 慍
悋リ惡惷愆:悋悵愕 惺惡 17
惓悋:悋惠惡惡愀惡悋惺惠  惠 惺莕 悋惆悸  惆惘悴惠 愀悋惡 悋愕 惡惘悋悄悸  惡惘リз悴 惆惘悴惠 悋愀悋惡 悋愕
惠"Pass "惠愕悋 悋  悋惡惘 悋悵惘悴惠 悋リ 悋惘悋50愀惡惺 悋悋惠 惆惘悴惠 悋愀悋惡 悋愕fail
悴忰 惠悋惠忰 悋悽惘 悋愆悋if悋慍惆悴忰
悋忰悋惷惘:悋悵惘 愕悋
18
悋忰悵忰 悴ル悽  悋愆愆愀 惘忰 忰惡悽  悴ル悽  悋惓愆
悋愆愆愀 惘忰 惺悵 忰惡悽 
 if (Logical Condition)
 {
 Statment1;
 Statment2;
 }
 else
 Statment1;
 next statement;
 悋忰悵忰 悴ル悽 悋愆愆愀 惘忰 忰惡悽悴ル悽  悋惓愆
悋愆愆愀 惘忰 惺悵 忰惡悽  悋忰悵忰
 if (Logical Condition)
 Statment1;
 Else
 {
 Statment1;
 Statment2;
 }
 next statement;
悋リ惡惷愆:悋悵愕 惺惡 19
惠惺惆 悋惠惓 悋惓愃 悋慍悋悴 忰 悋惓愃 惠愀惓悋惺忰  惓 悋慍悋悴 惶悋惡 悋 惓愃 忰 惠惘悋悄悴  惠惘悋悴 悋惠悸
悋慍悋悴 愕惓忰 悋 惺惠 悋悵悋 悋慍悋悴 忰 悽惶2.5. %悋慍悋悴 惶悋惡 悋惓愃 惠愃 悋悵悋.
import java.util.Scanner;
public class First{
public static void main(String[] args){
Scanner input= new Scanner (System.in);
double mb = 0,ns = 0,mm=0,zk=0;
System.out.print( "mb=");
mb=input.nextDouble();
System.out.print( "ns=");
ns=input.nextDouble();
if (mb>=ns)
{
zk = mb * 0.025;
mm = mb - zk;
System.out.println( "mb= " + mb);
System.out.println( "zk= " + zk);
System.out.println( "mm= " +mm);
}
else
System.out.println( "No zakat");
}}
悋惺愀悋悽:悋惷惡忰 惶惡悸  悋リ 悋リ愃
悋愀惡:悋リ愃 惺悴惡惺悽惺悴惡惺悽 忰愃惡悸 
悋悽惶 惓惺悵 悋リ茄 悋リ愃  悋惷惡忰 リ
悋惘惷悋悽:
悋リ愃:mb
悋惷惡忰 惶惡悸:ns
悋リ茄 悋リ愃:mm
悋惷惡忰 リ:zk
惓悋
悋リ惡惷愆:悋悵愕 惺惡
20
悋慍惠惓愆惡悴惓愆悋悄忰悋惺悋ル惴愕悋惘悴悋悖惺惡惺惓忰愃惠リ悋惷愆悴悽惶惡
悋リ関駅忰惓悖:
悋リ関駅 惶惡=悋悖惺惡惺 悋愆悋惘惠
 悋 悋悖惺惡惺 悋愆悋惘惠 惡 悒惘悋500(惷愆悴悽 惡 惴)
悋リ関駅 惶惡=悋悖惺惡惺 悋愆悋惘惠悋惷愆悴悽 リ
悋惷愆悴悽 リ 惘 惓忰惓5%悋悖惺惡惺 悋愆悋惘惠 
悋リ関駅 惶惡 悋ル惴 悋惺 惓愃悴惡惺悽  惓.
悋悽悋惘慍惠  悋愕悖惠 惠忰
悋リ惡惷愆:悋悵愕 惺惡
21
1.悋惓悵悋
2.悋ル惴 悋惺 悋愆悋悄Name悋悋惺惡惺 悋愆悋惘惠 Sal
3. 悋 悋愆悋惘惠 惡 悋惘悋500(Sal <500)
惘惓忰 悋 愕悸 悋tax惠忰tax=Sal*0
4. 悋悴愆 悋愆悋惘惠 惡 悋惘悋500(Sal >500)
惘惓忰 悋 愕悸 悋tax惠忰tax=Sal*0.05
5.悋リ関駅 惶惡 悋忰愃惠net忰惓net = Sal-tax
6.悋惺悴惺 悋ル惴 悋惺悋リ関駅 惶惡net
7.悋惡悽
悋リ惡惷愆:悋悵愕 惺惡 22
import java.util.Scanner;
public class First{
public static void main(String[] args){
Scanner input= new Scanner (System.in);
String name;
double sal=0, net=0, tax=0 ;
System.out.print( "Enter Name");
name=input.next();
System.out.print( "Enter Salary");
sal=input.nextDouble();
if (sal<=500)
{
tax = sal * 0;
net = sal - tax;
}
else
{
tax = sal * 0.05;
net = sal - tax;
}
System.out.println( "name= " + name);
System.out.println( "net= " + net);
System.out.println( "tax= " + tax);
}}
悋悋忰
悋愕惘悋惺 忰愕 愆惘
悋リ惡惷愆:悋悵愕 愃惺惆 惺惡
Salemaldrugi@gmail.com
Salemaldrugi@yahoo.com
23
悋リ惡惷愆:悋悵愕 惺惡

More Related Content

if Statment in java / By:Salem_Adrugi