Welcome to AMIE Study - AMIE India Students Forum

AMIE Study - AMIE India Students Forum

collapse collapse

* Shoutbox

Refresh History
  • [email protected]: Sir how to paid online fee
    September 09, 2019, 08:21:27 PM
  • imgk1985: Middle of Sep 2019.
    September 03, 2019, 12:12:49 PM
  • ad13feb: Good evening.. Date of section B result ?
    August 31, 2019, 03:31:54 PM
  • vae: hello
    August 26, 2019, 02:33:54 PM
  • imgk1985: Very Good Afternoon folks.
    August 23, 2019, 11:58:19 AM
  • vae: good morning
    August 19, 2019, 10:56:58 AM
  • ramajit: Section B results expecting by Sep 1st week
    August 14, 2019, 09:26:41 AM
  • imgk1985: When Can we expect Section B - Summer 2019 results?
    August 13, 2019, 02:38:02 PM
  • ramajit: Results of Section A for Summer 2019 exam have been declared. Click to View ...
    August 09, 2019, 09:50:12 AM
  • vae: Good Morning and wishing everyone a good month..........August
    August 01, 2019, 10:06:30 AM
  • vae: Good Morning
    July 31, 2019, 09:21:57 AM
  • vae: Hello every1
    July 22, 2019, 09:29:29 AM
  • vae: Encumbrance Certificate
    July 08, 2019, 02:47:40 PM
  • vae: Happy July 2019
    July 01, 2019, 12:34:44 PM
  • vae: Hello
    July 01, 2019, 12:34:32 PM
  • vae: Good Afternoon every1
    June 27, 2019, 02:23:34 PM
  • vae: hi
    June 23, 2019, 03:57:08 PM
  • Sujith Raj (AMIE - Civil): Download FUNDAMENTALS OF DESIGN AND MANUFACTURING -SUMMER 2015- Question Paper.---> CLICK---> [link] Raj (AMIE,CEng- Civil)
    June 18, 2019, 10:38:44 PM
  • Sujith Raj (AMIE - Civil): AMIE Section B Syllabus - Civil Engineering-----Link--->[link] ---->>>--->>> [link]  Thanks Sujith Raj (AMIE, Chartered Engineer - Civil)
    June 14, 2019, 12:13:57 PM
  • vae: Good Morning
    June 13, 2019, 09:30:47 AM

* Search


* User Info

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

* Board Stats

  • stats Total Members: 48954
  • stats Total Posts: 27556
  • stats Total Topics: 6679
  • stats Total Categories: 6
  • stats Total Boards: 31
  • stats Most Online: 626

Author Topic: PROGRAM TO CALCULATE THE FACTORIAL OF A GIVEN NUMBER  (Read 1235 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
4587 Views
Last post November 28, 2011, 07:18:22 PM
by praveen
0 Replies
1961 Views
Last post September 22, 2011, 12:49:13 PM
by prayrona
0 Replies
927 Views
Last post September 06, 2012, 09:05:23 PM
by sainathan
0 Replies
965 Views
Last post September 15, 2012, 04:48:54 PM
by jitu_12341
2 Replies
3245 Views
Last post July 16, 2016, 09:10:31 AM
by SatishPatil
6 Replies
2388 Views
Last post September 28, 2014, 06:12:14 PM
by rahulm500
4 Replies
3400 Views
Last post April 09, 2019, 11:50:44 AM
by vae

* Search

* Subscribe to Forum

Enter your email address:

Advertisement

* Recent Posts