Computer Science, asked by zaynakhan0510, 2 months ago

Write a program in java
to input a number and find the sum of its factors and print the sum.​

Answers

Answered by telangepratibha29198
0

Answer:

ok bro I try to write your answer

Answered by sandipkeshri765
1

Answer

import java.util.Scanner;

public class factor

{

public static void main(String args[])

{

Scanner Sc = new Scanner (System.in);

System.out.println ("Enter the number");

int n = Sc.nextInt ();

int s = 0;

for ( int i = 1; i<= n; i++)

{

if (n%i==0)

{

System.out.println ("factor of " +n+"is");

System.out.println (i);

s = s + i;

}

}

System.out.println("sum of its factor is = " +s);

}

}

Explanation:

mark me as brainliest

Similar questions