Ch5_22_DoWhileLoop

 package com.company;


import java.util.Scanner;

public class Ch5_22_DoWhileLoop {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter any to get natural numbers: ");
int n = scan.nextInt();
int i = 0;
do {
System.out.print(i + " ");
i++;
} while (i <= n);
}
}

Comments

Popular posts from this blog

#12_Binary searching

#10_Insertion in an array

#24_Stack_using_an_array