Welcome to AMIE Study - AMIE India Students Forum

AMIE Study - AMIE India Students Forum

collapse collapse

* Shoutbox

Refresh History
  • kirannm: hii
    February 18, 2018, 03:39:53 PM
  • GCPATIL: Can I reregistration of section A done by online procedure
    January 30, 2018, 06:45:08 PM
  • girish_amie: Please upload electrical engineering latest question paper
    December 06, 2017, 09:25:40 AM
  • JYOTI VERMA: agr kisi ko apna exam city and center change krana hom to use kya krna chahiye plz suggest.
    October 14, 2017, 01:16:11 PM
  • JYOTI VERMA: amie ka exam center kaise change kr skte hai agr kiisi ko pta ho to plz btaiye .
    October 14, 2017, 01:15:31 PM
  • anoop.goyal9: error in online fee payment for winter 2017 examination
    October 12, 2017, 07:23:34 AM
  • ramajit: [link]
    October 06, 2017, 12:34:12 PM
  • ramajit: yes.. results announced... me 2/3 passed in Sec-B prodn Engg... xo xo... wow....
    October 06, 2017, 12:34:09 PM
  • suji.sujithraj: Guys check your results... its announced...!!!
    October 06, 2017, 10:26:53 AM
  • ramajit: summer'17 result will come or not ?
    October 06, 2017, 06:44:28 AM
  • jitu12341: Result has been declared ♡♡♡♡
    October 06, 2017, 06:30:56 AM
  • jitu12341: breaking news results will be publshed in March 18 along with winter 17
    October 04, 2017, 12:54:36 PM
  • ramajit: any tentative date aware about Summer'17 result
    October 03, 2017, 03:13:48 PM
  • nelokulood: What is the last date to apply for lab and project for winter 2017 session
    October 02, 2017, 11:39:31 AM
  • nelokulood: When will amie summer  2017 results be published
    October 02, 2017, 11:38:50 AM
  • SnrTech: please upgrade my membership to super member I already made payments Rs.500/- into bank account
    September 27, 2017, 11:17:12 PM
  • jitu12341: Is there anybody having EL 404, circuit and field theory notes  please mail on [email protected]
    September 23, 2017, 05:53:34 AM
  • jitu12341: Result is expected in first week of October
    September 23, 2017, 05:48:39 AM
  • manirock87: Result kab aayega for summer 2017
    September 22, 2017, 06:59:35 AM
  • mudassir.search007: Do i need to pay a separate fee for the Section A examination after paying the re-registration Fee (SEC A)
    September 20, 2017, 10:25:06 PM

* Search


* User Info

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

* Board Stats

  • stats Total Members: 48503
  • stats Total Posts: 27304
  • stats Total Topics: 6595
  • stats Total Categories: 6
  • stats Total Boards: 31
  • stats Most Online: 626

Author Topic: PROGRAM TO CALCULATE THE FACTORIAL OF A GIVEN NUMBER  (Read 916 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
4267 Views
Last post November 28, 2011, 07:18:22 PM
by praveen
0 Replies
1660 Views
Last post September 22, 2011, 12:49:13 PM
by prayrona
0 Replies
723 Views
Last post September 06, 2012, 09:05:23 PM
by sainathan
0 Replies
770 Views
Last post September 15, 2012, 04:48:54 PM
by jitu_12341
2 Replies
2761 Views
Last post July 16, 2016, 09:10:31 AM
by SatishPatil
6 Replies
1791 Views
Last post September 28, 2014, 06:12:14 PM
by rahulm500
3 Replies
2379 Views
Last post November 09, 2016, 06:59:20 PM
by Saloni

* Search

* Subscribe to Forum

Enter your email address:

Advertisement