0% found this document useful (0 votes)
2 views2 pages

Java 6 Priyanka

Uploaded by

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

Java 6 Priyanka

Uploaded by

Priyanka Thadke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Name: Priyanka Khandu Thadke

Class:CO4I(A) Roll no:85

Practical no:-6 Develop programs to demonstrate use of ‘While’ , ‘do-while’.

Exercise:

Q.2)write a program to display number 1 to 50 using do-while loop.

class Dowhile

public static void main(String args[])

int i=1;

do

System.out.println(i);

i++;

while(i<=50);

OutPut:
Program for While loop:

class While

public static void main(String args[])

int i=1;

System.out.println("Even numbers betwen 1-20");

while(i<=20)

if(i%2==0)

System.out.println(i);

i++ ;

Output:

You might also like