Computer Science, asked by ammarussalamansari, 6 hours ago

create a jave program on any topic..
as per you choice...​

Answers

Answered by zayannavab
1

Answer:import java.io.*;

import java.util.*;

class Factorial {

   public static void main(String args[]) {

       try {

           Scanner sc = new Scanner (System.in);

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

           int a = sc.nextInt();

           int fact = 1;

           System.out.println("Factorial of " +a+ ":");

           for (int i = 1; i < a; i++){

               fact = fact * i;

           }

           System.out.println(fact);

       }

       catch (Exception e) {}

   }

   void SpecialNumbers() {

       int limit = 1000;

       for(int i = 1; i <= limit; i++){

           int n = i;

           // resolve the number  

           int rem, sum = 0;

           while(n > 0) {

               rem = n %10;           // get the reaminder

               n = n / 10;            // get the quotient

               sum += factorial(rem);

           }

           if(sum == i)

           System.out.println("Special number : " + i);

       }

   }

   private static int factorial(int number) {

       int f = 1;

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

       f *= i;

       return f;

   }

}

           

   

   

   

   

   

   

Explanation:

Answered by MrTSR
0

Cool, Here is the program for beginners to print HelloWorld.

public class HelloWorld {

public static void main(String args[]) {

   System.out.println("Hello World");

 }

}

Similar questions