- Joined
- Sep 14, 2018
- Posts
- 551
- Solutions
- 54
- Reaction
- 1,146
- Points
- 435
help pano po makuha yung last na na comma sa output? baka ma wrong ako , ito po code ko
/* Using while, do-while, or for loop, write a program that will produce this sequence of numbers:
1, 5, 2, 4, 3, 3, 4, 2, 5, 1 */
public class Sequence {
public static void main(String args[]) {
int n = 6;
for(int i = 1; i<n; ) {
int a= n - i;
System.out.print(i +", "+ a+", ");
i++;
}
}
}
/* Using while, do-while, or for loop, write a program that will produce this sequence of numbers:
1, 5, 2, 4, 3, 3, 4, 2, 5, 1 */
public class Sequence {
public static void main(String args[]) {
int n = 6;
for(int i = 1; i<n; ) {
int a= n - i;
System.out.print(i +", "+ a+", ");
i++;
}
}
}
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.
Last edited: