9:15 am - Wednesday December 19, 2018

Java Example Program to display Numbers from 1 to N using Do While Loop

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/*program to print numbers from 1 to N*/
/**
 * @author:candidjava.com
 * @Description:here, we are using do...while loop to print numbrs from 1 to N
 */

public class DeeDoWhile {
	public static void main(String args[]) {
		int i = 1;
		int N = 15;

		do {
			System.out.println(i);
			i++;
		} while (i <= 15);
	}
}

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Filed in: Z-A All Java Codes

Comments are closed.