Welcome to AMIE Study - AMIE India Students Forum

AMIE Study - AMIE India Students Forum

collapse collapse

* Shoutbox

Refresh History
  • vae: hi
    May 19, 2019, 03:21:54 PM
  • raviteja2412: I need mining engineering previous years question paper can anyone help me
    May 13, 2019, 06:20:39 PM
  • vae: Good afternoon every1
    May 09, 2019, 01:14:34 PM
  • vae: IMNA : EXCELLENT TUITIONS  136, First Floor, Above Raghavendra Enterprises, Coconut Avenue, 8th Cross, Malleswaram, Bangalore 560 003, India.  Phone: +91 9844027371
    May 02, 2019, 05:13:30 PM
  • vae: hellooooooooooooooooooooo
    May 02, 2019, 12:36:53 PM
  • vae: Shantanu09 - You can get the full notes if  U follow the link : [link]
    May 01, 2019, 12:44:07 PM
  • vae: Dear Shahul, kindly follow the link : [link] where you can get all details
    May 01, 2019, 12:42:37 PM
  • shantanu09: HLW everyone, can anyone send me notes for material scienece
    April 30, 2019, 05:43:38 PM
  • shahul: Any one can guide me, to join new membership ST (Diploma stream) by online???
    April 30, 2019, 04:30:47 PM
  • shahul: Good evening
    April 30, 2019, 04:29:18 PM
  • vae: Hi
    April 29, 2019, 12:42:11 PM
  • imna: i am looking for coaching class in Bangalore. Please I need guidance
    April 28, 2019, 09:42:40 AM
  • imna: hello anyone from bangalore?
    April 28, 2019, 09:37:41 AM
  • T-1700565: Please send AN 205 and AN 210 NOTES
    April 25, 2019, 10:06:09 PM
  • vae: Good Afternoon Everyone
    April 25, 2019, 10:36:29 AM
  • vae: Happy Easter Every1
    April 21, 2019, 12:53:46 PM
  • RK Electrical: Can anyone send me the fundamentals of design and manufacturing pdf book link?
    April 16, 2019, 10:29:00 PM
  • vae: Happy Vishu...Everyone
    April 15, 2019, 11:30:44 AM
  • vae: hello
    April 14, 2019, 12:45:51 PM
  • SUJEET KUMAR MISHRA: Good afternoon sir, mujhe sec-a, material science ka  notes  chahiye sir
    April 13, 2019, 10:40:49 AM

* Search


* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Board Stats

  • stats Total Members: 48881
  • stats Total Posts: 27506
  • stats Total Topics: 6655
  • stats Total Categories: 6
  • stats Total Boards: 31
  • stats Most Online: 626

Author Topic: PROGRAM TO CALCULATE THE FACTORIAL OF A GIVEN NUMBER  (Read 1173 times)

Description:
March 18, 2009, 03:08:05 PM
  • phpBB Moderator
  • Registered User
  • *
  • Posts: 56
    • View Profile
    • http://sites.google.com/a/daffodildb.com/study/Home
Advertisement
Code: [Select]
 /* PROGRAM TO CALCULATE THE FACTORIAL OF A GIVEN NUMBER */
  /*author-Rohit Wadhwa*/
   #include<stdio.h>
   #include<conio.h>
   void  main()
    {
    int n;
    int fact=1;
    int val;
    printf("Enter a number for Calculate Factorial:n");
    scanf("%d",&n);
    val=n;
    while(n>1)
    {
    fact*=n;/*fact=fact*n*/
    n--;
    }
    printf("Factorial of %d are: %dn",val,fact);
    getch();
    }
« Last Edit: January 01, 1970, 04:00:00 AM by Guest »


Thanks
Rohit Wadhwa
Site : Study Site
April 14, 2010, 04:39:05 AM
Reply #1
  • Super Member
  • Senior Member
  • **
  • Posts: 107
    • View Profile
Hello Mr. Rohit,
Thanks for the program, but I have some comments after execution.
This program is not calculating correct answer after 10 because value is getting hence I use "double" variable instead of int for factorial.
Find below my program in C++ , I appreciate comments....

/* Program to fing Factorial number*/

#include <iostream>
#include <cmath>
int main ()
{
    int n; /* n= Given number for which we want factorial */
    double f=1; /* f= factorial number */
    using namespace std;
    cout << "Please Enter the Number for which you want Factorial ??  " << endl;
    cin >> n;
     while (n!=0)
    {
    f=f*n;
    n=n-1;}  
    cout << "Factorial is     "<< f << endl;  
    system ("pause");
    return 0;
    }
« Last Edit: January 01, 1970, 04:00:00 AM by Guest »
Thanks & Best Regards -
Irfan M Ansari  - Section B - Civil
Bhiwandi - Dist THANE // MAHARSHTRA
Email :[email protected]
IM: [email protected]
April 15, 2010, 09:56:53 AM
Reply #2
  • phpBB Moderator
  • Registered User
  • *
  • Posts: 56
    • View Profile
    • http://sites.google.com/a/daffodildb.com/study/Home
Hello Mr Irfanmasiullah,

        you r right,this program is only give right result up to 10.Nice work keep it up.
you can also used long type for factorial result.
« Last Edit: January 01, 1970, 04:00:00 AM by Guest »
Thanks
Rohit Wadhwa
Site : Study Site
March 23, 2011, 04:07:44 PM
Reply #3
  • Registered User
  • *
  • Posts: 20
    • View Profile
« Last Edit: January 01, 1970, 04:00:00 AM by Guest »
Regards
Ramji R
 

Related Topics

  Subject / Started by Replies Last post
1 Replies
4531 Views
Last post November 28, 2011, 07:18:22 PM
by praveen
0 Replies
1891 Views
Last post September 22, 2011, 12:49:13 PM
by prayrona
0 Replies
888 Views
Last post September 06, 2012, 09:05:23 PM
by sainathan
0 Replies
929 Views
Last post September 15, 2012, 04:48:54 PM
by jitu_12341
2 Replies
3190 Views
Last post July 16, 2016, 09:10:31 AM
by SatishPatil
6 Replies
2296 Views
Last post September 28, 2014, 06:12:14 PM
by rahulm500
4 Replies
3077 Views
Last post April 09, 2019, 11:50:44 AM
by vae

* Search

* Subscribe to Forum

Enter your email address:

Advertisement

* Recent Posts

Re: All About AMIE by vae
[May 09, 2019, 04:40:15 PM]


Re: All About AMIE by vae
[May 09, 2019, 04:26:26 PM]


Re: All About AMIE by vae
[May 09, 2019, 01:12:24 PM]


Re: All About AMIE by vae
[May 09, 2019, 01:03:32 PM]


Re: All About AMIE by vae
[May 08, 2019, 04:59:27 PM]