i need a help in this please

i need a help in this please

The factorial of a nonnegative integer n is written n! (pronounced â?? n factorialâ??) and is defined as follows: n!=n . (n-1) . (n-2) . .... . 1 (for values of n greater than or equal to 1) and n!=1 (for n=0) for example, 5!=5.4.3.2.1, which is 120 a) Write an application that reads a nonegative integer from the user and computes and print its factorial. b) Write an application that computes the value of ex by using the formula ex = 1+(x/1!)+(x2/2!)+(x3/3!)+(x4/4!)+....

View Answers

May 9, 2011 at 11:36 AM

import java.util.*;
class  Factorial{
    public static void main(String[] args) 
    {
        Scanner input=new Scanner(System.in);
        System.out.print("Enter Number: ");
        int m=input.nextInt();
        long num=m;
        for(int i=m;i>1;i--){
            num=num*(i-1);
        }
        System.out.println(num);
    }
}









Related Tutorials/Questions & Answers:
i need a help in this please
i need a help in this please  The factorial of a nonnegative integer n is written n! (pronounced â?? n factorialâ??) and is defined as follows: n!=n...=input.nextInt(); long num=m; for(int i=m;i>1;i
need help please
need help please  Dear sir, my name is logeswaran. I have a big problem that I can't find the solution for a program. How can I block a user from enter a page second time. Please help me. By the way I'm using Access database
Advertisements
I really need help with this assignment question Please help me out Please
I really need help with this assignment question Please help me out Please  * Description* You are hired to develop a laptop inventory information... in MySQL. For this purpose you will need to use the sheridancollege database we
I need help on my Java code.... please please help me out!?
I need help on my Java code.... please please help me out!?  Well my... the anagram on screen or the output file! Please show me whats wrong. Thanks i need a part of the code thats fixed if possible! Heres is the code: import
need help...................please
need help...................please  I have a problem in my JSP Coding... on this area. Please help me. By the way, I'm using access Database and JSP coding...("GET",url,true) xmlHttp.send(null) } else{ alert("Please Select Employee Id
hello there i need help
i am a beginner, and aside from that i am really eager to learn java please help me with the codes and please explain to me how it works. i only need to use...hello there i need help  : i need to do a program like
I have need to help
I have need to help  Write a program that, for four points A, B, C and P, draws a triangle formed by ABC and a small cross showing the position of P; and displays a line of text indicating which of the following three cases
Please help need quick!!! Thanks
Please help need quick!!! Thanks  hey i keep getting stupid compile...]; for(int i = 0; i < team.length; i++){ team[i...(); array[4] = orangeboat.getSum(); for(int i = 1; i < array.length ; i
need to fix errors please help
need to fix errors please help  it does have 2 errors what should i...; String name2; System.out.println("please enter your name:"); name1= input.readline(); System.out.println("please enter your friend's name:"); name2
i need help - Development process
i need help  hello, i need help regarding this program. public... in the background. please guide me how i can run my program in the background...()); } } } it is printing the result of ping in to a file,but if i want
i need help - Development process
i need help  hello, i need help regarding this program. this program... IPAddress on command line, but i want to take it dynamically and it must store the result of ping in to a file . can anyone guide me how to do it please
i need help to solve this problem
i need help to solve this problem  Write a stack class ArrayStack.java implements PureStack interface that reads in strings from standard input.... H and I join the queue h. G leaves the queue i. H and I leave the queue
i need help plz .... Quickly
i need help plz .... Quickly   how can i count how many numbers enterd by the user so the output would be like this Total number of Scores = .... this is my code :- (adsbygoogle = window.adsbygoogle || []).push
beginner need help with online ordering program please
beginner need help with online ordering program please  I have created a program for an online ordering system and now have to add error handling and a few other things my teacher doesn't teach well is there a template I can go
Need Help Like No one Else Please
Need Help Like No one Else Please   write a program that computes miles per gallon for an automobile. The program should ask for the beginning mileage first. For each fill-up, the program should ask for the mileage and number
pls i need help with my assignment
pls i need help with my assignment  how to write a code that ask the user for the height of the triangle and prints the triangle using * eg if height is 3 it prints * and also using import java.util.Scanner
PLZ HELP ME. i need php code.
PLZ HELP ME. i need php code.   I want php code for bellow OUTPUT. output is just example but it must be letters only. abc bcd efg jku rgt azs hje qqc wws adt
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....   */ import...++) { System.out.println("Please insert number for element "+ i); double..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....   */ import...++) { System.out.println("Please insert number for element "+ i); double..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....   */ import...++) { System.out.println("Please insert number for element "+ i); double..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....   */ import...++) { System.out.println("Please insert number for element "+ i); double..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....  import...("Please insert number for element "+ i); double element..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....  import...("Please insert number for element "+ i); double element..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....  import...("Please insert number for element "+ i); double element..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....  import...("Please insert number for element "+ i); double element..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....  import...("Please insert number for element "+ i); double element..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....  import...("Please insert number for element "+ i); double element..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....  import...("Please insert number for element "+ i); double element..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....  import...("Please insert number for element "+ i); double element..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....  import...("Please insert number for element "+ i); double element..."); System.out.println("| i. Print the list from a specified index
how to i convert this case to loop...please help.....
how to i convert this case to loop...please help.....  import...("Please insert number for element "+ i); double element..."); System.out.println("| i. Print the list from a specified index
i need some help in understanding the following codes.thanks..
i need some help in understanding the following codes.thanks..  this code is to perform LocalColorHistogram.But i can't understand it public... * height; int i = 0; int j = 0; int k = 0; double
struts problem ... need help urgently.. please reply ASAP
struts problem ... need help urgently.. please reply ASAP  Hi Every1, I want to make an application using struts 1.2. I am a beginner on struts. Dont know much about struts. In application I have to make jsp to get some
I need your help - Java Beginners
I need your help  For this one I need to create delivery class... - 2025)."); System.out.print("Please re-enter year: "); y=input.nextInt... be in the range of (1 - 9999)."); System.out.print("Please re-enter delivery
PLZ Need some help on the 2nd part of this question...Someone please help !!!!
PLZ Need some help on the 2nd part of this question...Someone please help !!!!  write an application that displays a menue of three items in a restaurant as follows: 1.Cheeseburger 4.99 2.Pepsi 2.00 3.Chips 0.75 prompt the user
need help pleaseee....i weak in java
need help pleaseee....i weak in java  QUESTION 1 You are required to write an application called Customer Billing System. This system...) Separate them as either R/r for Residential or I/i for Industrial. You can use
I need your help - Java Beginners
I need your help  What is the purpose of garbage collection in Java, and when is it used?  Hi check out this url : http://www.artima.com/insidejvm/ed2/gc.html http://java.sun.com/javase/technologies/hotspot
I need help in doing this. - Java Beginners
I need help in doing this.  Student DataBase i will need creating..., and the student's GPA.using arrays and objects, need to structure the information... objects that will house the birthdates for each student member. (I have
i need your help - Java Interview Questions
i need your help  Write a java program that: i. Allows user to enter 2 numbers from the keyboard ii. Uses a method to compare the two numbers to determine which is larger iii. Print to the screen stating which number is larger
Begineer Help Help Please Thanks A million ) I am using Jcreator
Begineer Help Help Please Thanks A million ) I am using Jcreator  System.out.println(" Income Statement...: $ 1.00 Retained Earnings: $ 2.00 I don't know how to sort the array
I want to build sessionfactory in hibernate 4. Need help.
I want to build sessionfactory in hibernate 4. Need help.  Hello, I want to build sessionfactory in hibernate 4. Need help
i need latest oracle certified java dumps.. Pleas help me?
i need latest oracle certified java dumps.. Pleas help me?  i need latest oracle certified java dumps.. Pleas help me
I am having problem with configuring Hibernate sessionfactory. Please Help
I am having problem with configuring Hibernate sessionfactory. Please Help  Sir, I am having problem with configuring Hibernate sessionfactory.. I... and finding it difficult to configure the file.. Can you please help me.. Thanks
please help//
please help//  Number square cube 1 1 1 3... 81 729 total 165 1225 â?? this is the ouput..;;; i need program   class SquareAndCube { public static void main(String
please help//
please help//  Number square cube 1 1 1 3... 81 729 total 165 1225 â?? this is the ouput..;;; i need program   class SquareAndCube { public static void main(String
please help//
please help//  Number square cube 1 1 1 3... 81 729 total 165 1225 â?? this is the ouput..;;; i need program   class SquareAndCube { public static void main(String
this is my javascript code and i am not understanding the mistake in this,please help me?
this is my javascript code and i am not understanding the mistake in this,please help me?  <html> <h2>Form Validation</h2>...; if((nn1.value==null)||(nn1.value=="")){ alert("Please Enter
inheritance....please help me friends...!!!... this is important project that i have to do it..
inheritance....please help me friends...!!!... this is important project that i have to do it..   Point ................. #x : int #y : int + Point() + Point(xCoordinate:int, YCoordinate:int) + getX() : int + getY() : int
( Inheritance, Polymorphism, Overriding)i need help - Java Beginners
( Inheritance, Polymorphism, Overriding)i need help  Advanced Concepts with Classes( Inheritance, Polymorphism, Overriding) i need help to create this application,than you Employees in a company are divided into the classes
Need help
Need help  Dear sir, I have a problem. How to write JSP coding, if a user select a value from drop down list for example department, the another drop.... This name list should get from the database. Please help me. By the way, I'm

Ads