0

Can anyone tell me if the output is 2 it prints 2 two times and if 5 five times but I just want to print once it's about lab num

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc = new Scanner (System.in); int input = sc.nextInt(); int a =0; for (int i=2;i<=input-1;++i){ if (input%i==0){ a = i; } System.out.print(a); } } }

3rd May 2020, 8:35 AM
Shivam Rawal
4 Réponses
0
I want to print lab number in coder challange
3rd May 2020, 9:11 AM
Shivam Rawal
0
What is the need of for loop in the program. You just want to print once the number remove for loop. Tell me what is the meaning of "lab num" in your question.
3rd May 2020, 8:02 PM
Dasarath Singh