public class Main { public static void main(String args[]) { int x,n=2,count=0; for(x=1; x<=100; x++) { if(x%n==0) { count=count+1; } } System.out.print(count); } }
50
public class Main { public static void main(String args[]) { int x,n,count=0; n=Integer.parseInt(args[0]); int x,n=2,count=0; for(x=1; x<=100; x++) { if(x%n==0) { count=count+1; } } System.out.print(count); } }
50
import java.util.*; public class Main { public static void main(String args[]) { int x,n,count=0; Scanner s=new Scanner(System.in); System.out.println("Enter n value: "); n=s.nextInt(); for(x=1; x<=100; x++) { if(x%n==0) { count=count+1; } } System.out.print(count); } }
Enter n value : 2
50