KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Give output of the following function 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

3 Likes

Answer

1
2
3
4
6
12

Working

This function finds the factors of n.

Answered By

1 Like