Share on Google+Share on Google+

zaara ahmad
i need a help in this please
1 Answer(s)      5 years and 11 months ago
Posted in : JavaMail

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!)+....

Ads

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
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
Advertisements
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
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 :- import java.util.Scanner; public class SCORES { public
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
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
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
Tutorials   
Java Spring Hibernate Struts Training program paradigams program paradigams program paradigams automatically resend when connection lost in sending email automatically resend when connection lost in sending email automatically resend when connection lost in sending email java mail send using setText() how to send message java code to send email using gmail smtp server Sending email with read and delivery requests values of the "from address & to addresses" while sending a mail to localhost using javamail projects Autodownload email attachments Reading the body of mail excluding the signature how to send contact detail in email problem in viewing the mail's content using javamail how to send mail with multiple attachments in jsp Core java Exception in thread java mail java mail API sending mail using jsp attendance management system source code Multiplication table code for sending email using j2me audio video conferencing Java Email automate mails in lotus notes java mail sending with images Code for opening a new mail from the default mail box and copy the database contents Sending Emails In Java Sending Emails In Java Sending Emails In Java sending email using smtp in java java mail programs How to send sms alerts to mobile using java? get from address using javamail api? mail java How can java programs execute automatically when it connects to network I want complete tutorial on advanced java email java result after compilation TEST JAMES MAIL SERVER i need a help in this please javamail help in java help in java Request URl using Retrive data from dtabase

Ads

 
Advertisement null

Ads