SlideShare a Scribd company logo
Tringa Tahiri
 Unazat që përdoren në gjuhë të ndryshme
programuese janë while, do-while dhe for.
 Blloku i unazës është i mbyllur në kllapa gjarpërore,
kështu që çfardo që duam të përsërisim duhet ta
vendosim brenda bllokut.
 Përderisa kushti që e kemi dhënë në unazë është i
saktë do të ekzukutohet çdo gjë që ndodhet brenda
bllokut të unazës .
 Nëse kushti është i pasaktë atëherë do vazhdohet të
ekzekutohet pjesa nën bllok e programit.
 Pjesa kyqe në unazë është kushti, i cili është
shprehje që jep vlerë Boolean.
 Vlerë Boolean diqka që mund të jetë true ose
false.
 Për të vendosur një kusht përdorim operatorët
krahasues:
< (më i vogël )
> (më i madh)
== (barazim)
Vëreni: “==“ dallon nga “=“ një barazim përdoret për
t’ia shoqëruar një vlerë një variable ndërsa dy
barazime për të bërë krahasim!
Shembull1:
int x=4;
while (x>3) { blloku i unazës ekzekutohet.
x=x-1;
}
Shembull2:
int z=27;
while (z==17){
}
Blloku i unazës nuk do të ekzekutohet
 Shembull i unazës while:
public class Loopy{
public static void main (String [ ] args){
int x=1;
System.out.println(“ Para unazës”);
while (x<3){
System.out.println(“Në unazë”);
System.out.println(“Vlera e x është “ +x );
x=x+1;
}
System.out.println ( Pas unazës);
}
}
Para unazës
Në unazë
Vlera e x është 1
Në unazë
Vlera e x është 2
Pas unazës ëhile:
Deklaroje i dhe
jepi vlerë zero
Shtype
“përfundoi”
Futu në
bllok
Shtype
vlerën e i
Rrite i -në
i < 8
int i =0;
while (i<8) {
System.out.println(i);
i++;
}
System.out.println (“përfundoi”);
false
true
 Kushti Boolean duhet të vendoset brenda kllapave.
 Unaza while është e mirë kur ne nuk e dijmë sa herë të
bëjmë loop dhe vetëm dëshirojmë të vazhdojmë deri sa të
plotësohet kushti.
 Nëse dijmë sa herë duhet të përsëritet cikli atëherë
përdorim unazën for.
 USHTRIME
1. Tregoni cili nga këto programe do të ekzekutohet?
A
class Ushtrimi1
public static void main (String [ ] args){
int x =1;
while (x <10){
if (x>3){
System.out.println(“big x”);
}
}
}
}
B
public static void main (String [ ] args){
int x =5;
while (x >1){
x=x-1;
if (x<3){
System.out.println(“small x”);
}
}
}
2. Vendosni në program pjesë të kodit nga ana e djathtë dhe lidhni me shigjeta me rezultatin që fitohet?
class Test
public static void main (String [ ] args){
int x =0;
int y=0;
while (x < 5){
System.out.println(x + “ ” + y + “ “);
x= x+1;}
}
}
y= x - y; 00 11 23 36 410
y= y + x; 00 11 21 32 42
y= y + 2;
If (y>4){
Y= y – 1;}
02 14 25 36 47
11 34 59
kodi rezultati
3. Plotësoni vendet e zbrazëta në mënyrë që të fitohet rezultati në anën e majtë?
A
public class NataDita {
public static void main(String [] args){
int x=1;
while ( x< ){
System.out.println (“Nata”);
System.out.print (“Dita”);
x=x+1;
}
if (x == ){
System.out.println (“Ditaaa”);}
}
}
NataDitaNataDitaDitaaa

More Related Content

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Erica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Unazat

  • 2.  Unazat që përdoren në gjuhë të ndryshme programuese janë while, do-while dhe for.  Blloku i unazës është i mbyllur në kllapa gjarpërore, kështu që çfardo që duam të përsërisim duhet ta vendosim brenda bllokut.  Përderisa kushti që e kemi dhënë në unazë është i saktë do të ekzukutohet çdo gjë që ndodhet brenda bllokut të unazës .  Nëse kushti është i pasaktë atëherë do vazhdohet të ekzekutohet pjesa nën bllok e programit.
  • 3.  Pjesa kyqe në unazë është kushti, i cili është shprehje që jep vlerë Boolean.  Vlerë Boolean diqka që mund të jetë true ose false.  Për të vendosur një kusht përdorim operatorët krahasues: < (më i vogël ) > (më i madh) == (barazim) Vëreni: “==“ dallon nga “=“ një barazim përdoret për t’ia shoqëruar një vlerë një variable ndërsa dy barazime për të bërë krahasim! Shembull1: int x=4; while (x>3) { blloku i unazës ekzekutohet. x=x-1; } Shembull2: int z=27; while (z==17){ } Blloku i unazës nuk do të ekzekutohet
  • 4.  Shembull i unazës while: public class Loopy{ public static void main (String [ ] args){ int x=1; System.out.println(“ Para unazës”); while (x<3){ System.out.println(“Në unazë”); System.out.println(“Vlera e x është “ +x ); x=x+1; } System.out.println ( Pas unazës); } } Para unazës Në unazë Vlera e x është 1 Në unazë Vlera e x është 2 Pas unazës ëhile:
  • 5. Deklaroje i dhe jepi vlerë zero Shtype “përfundoi” Futu në bllok Shtype vlerën e i Rrite i -në i < 8 int i =0; while (i<8) { System.out.println(i); i++; } System.out.println (“përfundoi”); false true
  • 6.  Kushti Boolean duhet të vendoset brenda kllapave.  Unaza while është e mirë kur ne nuk e dijmë sa herë të bëjmë loop dhe vetëm dëshirojmë të vazhdojmë deri sa të plotësohet kushti.  Nëse dijmë sa herë duhet të përsëritet cikli atëherë përdorim unazën for.
  • 7.  USHTRIME 1. Tregoni cili nga këto programe do të ekzekutohet? A class Ushtrimi1 public static void main (String [ ] args){ int x =1; while (x <10){ if (x>3){ System.out.println(“big x”); } } } } B public static void main (String [ ] args){ int x =5; while (x >1){ x=x-1; if (x<3){ System.out.println(“small x”); } } }
  • 8. 2. Vendosni në program pjesë të kodit nga ana e djathtë dhe lidhni me shigjeta me rezultatin që fitohet? class Test public static void main (String [ ] args){ int x =0; int y=0; while (x < 5){ System.out.println(x + “ ” + y + “ “); x= x+1;} } } y= x - y; 00 11 23 36 410 y= y + x; 00 11 21 32 42 y= y + 2; If (y>4){ Y= y – 1;} 02 14 25 36 47 11 34 59 kodi rezultati
  • 9. 3. Plotësoni vendet e zbrazëta në mënyrë që të fitohet rezultati në anën e majtë? A public class NataDita { public static void main(String [] args){ int x=1; while ( x< ){ System.out.println (“Nata”); System.out.print (“Dita”); x=x+1; } if (x == ){ System.out.println (“Ditaaa”);} } } NataDitaNataDitaDitaaa