Printing 1 to 10 using do while loop

Printing 1 to 10 using do while loop

Printing 1 to 10 using do while loop 


PROGRAM

import java.util.*;
class dowhile1to10
{
public static void main()
{
int a,b;
Scanner sc=new Scanner(System.in);
System.out.print("Enter initial number : ");
a=sc.nextInt();
System.out.print("Enter upto you Final number : ");
b=sc.nextInt();
    do {
        System.out.println(a);
        a++;
    }
    while(a<=b);
}
}

OUTPUT

Printing 1 to 10 using do while loop

Post a Comment

0 Comments