Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
•
Sichere ProgrammierungStudyBuddy AI – A Personal Learning Assistant(02.10.2026 um 14:45 Uhr)
••••
Sichere ProgrammierungWhat Now?: because every long email hides a to-do list(02.10.2026 um 14:52 Uhr)
•
Sichere Programmierung🔐 Demystifying NIST SP 800-53(02.10.2026 um 14:53 Uhr)
•
Sichere ProgrammierungWhat Giving Interviews Taught Me Beyond Just Getting an Internship(02.10.2026 um 14:54 Uhr)
•
Sichere ProgrammierungAI Made Me Faster. It Also Exposed What I Didn't Understand(02.10.2026 um 14:55 Uhr)
•
Sichere ProgrammierungI Built an E-Ink Weather Frame for My Kids Who Can't Read Yet(02.10.2026 um 14:55 Uhr)
••
Sichere ProgrammierungStudyBuddy AI – A Personal Learning Assistant(02.10.2026 um 14:45 Uhr)
••••
Sichere ProgrammierungWhat Now?: because every long email hides a to-do list(02.10.2026 um 14:52 Uhr)
•
Sichere Programmierung🔐 Demystifying NIST SP 800-53(02.10.2026 um 14:53 Uhr)
•
Sichere ProgrammierungWhat Giving Interviews Taught Me Beyond Just Getting an Internship(02.10.2026 um 14:54 Uhr)
•
Sichere ProgrammierungAI Made Me Faster. It Also Exposed What I Didn't Understand(02.10.2026 um 14:55 Uhr)
•
Sichere ProgrammierungI Built an E-Ink Weather Frame for My Kids Who Can't Read Yet(02.10.2026 um 14:55 Uhr)
•
Intelligence View
⚡ tsecurity.de Intelligence

Program on while loop

1)Print numbers from 1 to 10: public class Seven{ public static void main (String[] args){ int no=1; while(no

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

1)Print numbers from 1 to 10:

public class Seven{

public static void main (String[] args){

int no=1;

while(no<=10){

System.out.print(no);

no++;

}

}

}



2)To find even and odd numbers from 1 to 20:

public class Eight{

public static void main (String[] args){

int no=1;

while(no<=20){

if(no%2==0){

System.out.println("the even no is " +no);

no++;

}else{

System.out.println("the odd no is " +no);

no++;

}

}

}

}



3)Five tables:

public class Nine{

public static void main (String[] args){

int no=1;

while(no<=10){

System.out.println(no + " * 5 = " + no*5);

no++;

}

}

}



4)Print numbers in reverse 5 to 1:

public class Ten{

public static void main (String[] args){

int no=5;

while(no>=1){

System.out.println(no);

no--;

}

}

}



5)To count the numbers number=1+2+3+4+5=15:

public class Eleven{

public static void main (String[] args){

int count=0;

int no=1;

while(no<=5){

count=count+no;

no++;

}

System.out.println(count);

}

}



6)To print the alphabet from A to Z:

public class Alphabet_w{

public static void main (String[] args){

char ch='A';

while(ch<='Z'){

System.out.print(ch+"");

ch++;

}

}

}



7)To print the alphabet by combination of if condition when character is P print string "Preethi":

public class Alphabet_Condition_w{

public static void main (String[] args){

char ch='A';

while(ch<='Z'){

if(ch=='P'){

System.out.println("Preethi");

}else{

System.out.println(ch);

}

ch++;

}

}

}

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Program on while loop

Thematisch verwandte Begriffe: Program, while, loop · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag