Java with BlueJ in Hindi - Part 30

preview_player
Показать описание
Learn Java with BlueJ IDE in Hindi - Part 30
Syllabus according to Class 9 of ICSE
Chapter 8 part 8
Iterative Constructs in Java.Example program to find all the Factors of a given number
Рекомендации по теме
Комментарии
Автор

// Find out factors of a number.

import java.util.Scanner;
public class FindFactors
{
public static void main(String[] args)
{
Scanner x=new Scanner(System.in);
System.out.println("Enter a number");
int n = x.nextInt();
for(int i = 1 ; i < n ; i++)
{
if(n % i == 0)
System.out.println(i + " is a factor of " + n);
}
x.close();
}
}

ComproliveHindichannel