Machine Problem
Write a program using for loop that will display a series of a number from
1 to 100 in ascending order and 100 to 1 in descending order using Java programming language.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com
If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.
Your support on my channel is highly appreciated.
Program Listing
/* Print_1_100,java
* Author : Jake Rodriguez Pomperada, MAED-IT, MIT
* September 17, 2021 Friday 10:56 PM
* www.jakerpomperada.blogspot.com and www.jakerpomperada.com
* jakerpomperada@gmail.com
* Bacolod City, Negros Occidental Philippines.
*
* Machine Problem
*
* Write a program using for loop that will display a series of a number from
* 1 to 100 in ascending order and 100 to 1 in descending order.
*/
public class Print_1_100 {
public static void main(String[] args) {
int counter=0;
System.out.println("\n");
System.out.print("\tPrint 1 to 100 in Ascending and Descending Order in Java");
System.out.println("\n");
System.out.println("\t\tPrint 1 to 100 in Ascending Order");
System.out.println();
System.out.print("\t");
for (int a=1; a<=100; a+=1) {
counter++;
System.out.print( a +",");
if(counter == 25){
System.out.print("\n\t");
counter = 0;
}
}
System.out.println("\n");
System.out.println("\t\tPrint 100 to 1 in Descending Order");
System.out.println();
System.out.print("\t");
for (int a=100; a>=1; a-=1) {
counter++;
System.out.print( a +",");
if(counter == 25){
System.out.print("\n\t");
counter = 0;
}
}
System.out.println("\n");
System.out.print("\t\t\t\tEND OF PROGRAM");
System.out.println("\n");
}
}
No comments:
Post a Comment