Question
public class Javaprogram25 { public static void main(String[] args) { int w = 1; while(w
public class Javaprogram25 { public static void main(String[] args) { int w = 1; while(w<=5) { System.out.println("Nazmul"); w=w+1; } } } public class Javaprogram26 { public static void main(String[] args) { int w = 1; while(w <=19) { System.out.println(w); w++; } } } public class Javaprogram26 { public static void main(String[] args) { int w = 1; while(w <=19) { System.out.println(w); w++; } } } public class Javaprogram27 { public static void main(String[] args) { int w = 19; while(w>= 5) { System.out.println(w); w--; } } } public class Javaprogram28 { public static void main(String[] args) { int w; w = 5; while(w<=19) { System.out.println(w); w=w+5; } } } public class Javaprogram29 { public static void main(String[] args) { int w; w = 5; while(w<=31) { if(w%2==0) System.out.println(w); w++; } public class Javaprogram30 { public static void main(String[] args) { int w; w = 5; while(w<=31) { if(w!=12 && w%2==0) System.out.println(w); w++; } } } public class Javaprogram31 { public static void main(String[] args) { int w = 5; while(w<=33) { if(w%2!=0) System.out.println(w); w++; } } } public class Javaprogram32 { public static void main(String[] args) { int w,sum; sum = 0; w = 1; while(w<= 10) { sum = sum +w; w++; } System.out.println("Sum of 1 to 10 is " + sum); } } public class Javaprogram33 { public static void main(String[] args) { int w, sum; w = 1; sum = 0; while(w<= 19) { if(w%5==0) sum=sum+w; w++; } System.out.println("Sum of multiple of 5 from 1 to 19: " +sum); } } import java.util.Scanner; public class Javaprogram34 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a, w = 1; System.out.println("Enter the list number"); while(w<=7) { a=in.nextInt(); System.out.println(a); w++; } } } public class Javaprogram35 { public static void main(String[] args) { int w,a; String first; w=1; while(w<=7) { first = JOptionPane.showInputDialog("Input list"); a = Integer.parseInt(first); first = "The value enetred is " +a; JOptionPane.showMessageDialog(null, first); System.out.print(a); w++; } System.exit(0); } import java.util.Scanner; public class Javaprogram36 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int sum = 0,a, w = 1; System.out.println("Enter the list number"); while(w<=7) { a=in.nextInt(); sum= sum+a; w++; } System.out.println("The sum is: " +sum); } } import java.util.Scanner; public class Javaprogram37 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a, w = 1; System.out.println("Enter the list number"); while(w<=7) { a = in.nextInt(); if(a>=8 && a<=12) System.out.println(a); w++; } } }
program these code using for loop and do while code seperatly
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started