What is the exact output of the following program Show publi
Solution
Program :
public class PrintValues{
// class Declaration with a name PrintValues
public static void main(String []args){
// main function
int x=25;
// The value of x is 25
PrintValues(x);
// The calling function send a value of 25
System.out.println(\"----------\");
// The called function terminates then it prints
}
public static void PrintValues(int n) {
// The called function take the value of 25, so n value is 25
for(int value=n;value>0;value=value-1)
// Initially variable value contain 25 and the loop runs from 25 through 1
if(value%3==0)
// check if the reminder is 0 when the value divided by 3
System.out.println(\"value= \"+value);
// if reminder is 0 then print the value, it prints the multiples of 3 in between 25 to 1
}
}
Output :
value= 24
value= 21
value= 18
value= 15
value= 12
value= 9
value= 6
value= 3
----------
![What is the exact output of the following program? Show public class PrintValues {public static void main (String[] args) {int x = 25; PrintValues(x); System.o What is the exact output of the following program? Show public class PrintValues {public static void main (String[] args) {int x = 25; PrintValues(x); System.o](/WebImages/30/what-is-the-exact-output-of-the-following-program-show-publi-1085105-1761570461-0.webp)
![What is the exact output of the following program? Show public class PrintValues {public static void main (String[] args) {int x = 25; PrintValues(x); System.o What is the exact output of the following program? Show public class PrintValues {public static void main (String[] args) {int x = 25; PrintValues(x); System.o](/WebImages/30/what-is-the-exact-output-of-the-following-program-show-publi-1085105-1761570461-1.webp)