0
Heeeelp!!!
can u guys plz help me to create a prgrm in Java to input a no. and then take the factors of the no. (not print them) thanks
5 Respostas
+ 4
There is nothing to laugh, I had also started it one day :-)
To get your factors, add this after for(input.....):-
System.out.println(l);
Hope to see you progress fast :-)
Best of luck.
+ 3
import java.util.Scanner;
public class Program
{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int input=sc.nextInt();
int count=0;
for(int l=1;l<=input;l++){
if(input%l==0){
count++;
}
int[] arr=new int[count];
for(int x=0;x<arr.length;x++){
arr[x] = l;
}
}
}}
+ 2
Scanner sc=new Scanner (System.in);
int input=sc.nextInt();
for(int l=1;l<=input;l++)
if(input%l==0)
//get your factors here
0
plz tell me how to take the factors
..plz don't laugh actually I m really new to java
0
bro I said not to print just like to take the factors into an array