-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoWhile.java
47 lines (31 loc) · 814 Bytes
/
DoWhile.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.util.Scanner;
public class DoWhile
{
public static void main(String [] args)
{
int a, b, c;
Scanner x = new Scanner(System.in);
System.out.println("Starting Value: ");
a = x.nextInt ();
System.out.println("Ending Value: ");
b = x.nextInt ();
System.out.println("Interval: ");
c = x.nextInt ();
System.out.print("Sequence Value: ");
a = a;
if(a < b)
do
{
System.out.println(" " + a);
a+=c;
}
while(a<= b);
else
do
{
System.out.print(" " + a);
a = a - c;
}
while (a>=b);
}
}