Computer Science, asked by purwasingh2222, 11 months ago

System.out.println("2 to the power of" + i +" is "+ resul
System.out.println("2 to the power of" + p + " is "+ n);
redict the output :
class FindFac {
public static void main(String args[]) {
for(int i = 2; i <= 100; i++) {
System.out.print("Factors of" + i + ": ");
for(int j = 2; j<i; j++)
if((i%]) == 0) System.out.print(j + " ");
System.out.println();
ant and also mention ho​

Answers

Answered by amruthamanisai587
0

Answer:

here there is mistake in a statement please update that i.e.

if(i%j==0) you have not mentioned "j" in your program you will get error if you did not mention that

Explanation:

coming to the output of the program

you will get the factors of all the numbers from 1 to 100

for example:

if i=6

then you will get the output as

"Factors of 6: 2 3"  

similarly you will get this for all the numbers (1-100)

though 1 is a factor of every number here we are starting loop from 2 so, 1 is excluded and similarly we cannot get the number itself as the factor because we are ending the loop before that

please let me know if you need more clarification on this feel free to text me

Similar questions