KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Give output of the following method definition and also write the mathematical operation they carry out:


void test1(int n)
{
for(int x=1; x<=n; x++)
if(n%x == 0)
    System. out.println(x);
}

if 12 is passed to n.

Java

User Defined Methods

ICSE

134 Likes

Answer

1
2
3
4
6
12

Working

This method finds the factors of n.

Answered By

60 Likes