C++ Program to calculate the factorial of a given number | C++ Program | Class XI

how to write a C++ program or a code to calculate the factorial of a given number. basic program, easily understandable.


Write a C++ Program to calculate the factorial of a given number

Calculating factorial of numbers in C++ Programming Language

Code Sample 1 (for Dev C++ & CodeBlocks)


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
     #include<iostream>
     
     using namespace std;
     
     int main()
     {
      int x,f=1;
      cout<<"Enter the number to find its factorial:-\t";
      cin>>x;
      for(int i=1;i<=x;i++)
      {
       f=f*i;
 }
   cout<<"The factorial of "<<x<<" is "<<f;
   return(0);
     }

Code Sample 2 (for Turbo C++)


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
     #include<iostream>

     void main()
     {
         clrscr();
         int x,f=1;
         cout<<"Enter the number to find its factorial:-\t";
         cin>>x;
         for(int i=1;i<=x;i++)
         {
             f=f*i;
         }
         cout<<"The factorial of "<<x<<" is "<<f;
         getch();
     }

Sample Output:

factorial number calculator c++ program code cbse class 11
aptitude amplifier c++ coding


Programs on control structures and string manipulations under C++ Programming language are covered here.
___________________________________________________________________

Know more about stuff related to this practical experiment (Important for Boards):-

Reference:-

Comment down about what you think went wrong with your code, is this correctly working for you? What else do you need for your coding lust?

For latest syllabus, both theory and practical papers for class XII, check out the CBSE’s official site http://cbseacademic.in/ for more info.



For more awesome coding and programs related to this language log onto http://www.thecrazyprogrammer.com or https://www.w3schools.in/.
___________________________________________________________________

Related Questions-
Loop Based program code
Loops for while
Array manipulations
Header files
Dev c++
Turbo C++
CodeBlocks
CBSE class 12 computer science practicals
CBSE class XII computer science practicals
Benzoic Acid
___________________________________________________________________

Aptitude Amplifier ©2014-2018. All Rights Reserved.
  • [message]
    • ##check##NOTE:
      • E&OE, means errors and omissions are expected and accepted, in other words, if there is any error in the following article, the same has to be corrected by the user or the beneficiary accordingly.
        This article contains works derived from other reputed works of huge publication houses and notes that were made by me in my school life.These articles are just to help people who need these articles desperately and urgently. Any queries, complaints, and corrections will be enthusiastically entertained.

COMMENTS

BLOGGER

$hide=mobile

Name

Arrays,6,Blogger,2,C++,9,CBSE,19,Chemistry,9,Class 11,9,Class 12,9,CodeBlocks,9,Coding,13,Compulsory English,9,Computer Science,9,Craft,1,CreMat,4,Dev C++,9,EduMat,67,English,9,George Bernard Shaw,1,Graduation,50,Hardware,2,IGNOU,47,Internet,9,KB,3,Loops,7,Network,11,Notes,49,Organic,6,Others,1,Physical,3,Post Graduation,43,Practicals XI,9,Practicals XII,9,Programming,9,Qualitative Analysis,6,Quantitative Analysis,4,R.K. Narayan,3,Rabindranath Tagore,1,SAP,97,Sociology,41,Sociology Honors,43,Software,8,Special,3,Stephen Leacock,3,Strings,2,Structures,1,Turbo C++,9,Tweaks and Tricks,23,University of Calcutta,50,William Shakespeare,1,Windows,5,Windows 7,2,Windows 8,2,Yoga,3,
ltr
item
Aptitude Amplifier: C++ Program to calculate the factorial of a given number | C++ Program | Class XI
C++ Program to calculate the factorial of a given number | C++ Program | Class XI
how to write a C++ program or a code to calculate the factorial of a given number. basic program, easily understandable.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRRL5I89YJlPqli0IcyU6w4mbGeG8Ocmi7F6YYi5wmNv6eL6xrfALtk3pAm4PB3VPCZKA-U7LYjqkphXE28ABHRaP-wN5zdxTOnpZpPncyOH5QyV3ksEemuhtP7M9_07uLVanYGRZRiDj0/s640/factorial.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRRL5I89YJlPqli0IcyU6w4mbGeG8Ocmi7F6YYi5wmNv6eL6xrfALtk3pAm4PB3VPCZKA-U7LYjqkphXE28ABHRaP-wN5zdxTOnpZpPncyOH5QyV3ksEemuhtP7M9_07uLVanYGRZRiDj0/s72-c/factorial.jpg
Aptitude Amplifier
https://aptitudeamplifier.blogspot.com/2018/11/c-plus-plus-program-calculate-factorial-number.html
https://aptitudeamplifier.blogspot.com/
https://aptitudeamplifier.blogspot.com/
https://aptitudeamplifier.blogspot.com/2018/11/c-plus-plus-program-calculate-factorial-number.html
true
1849318885804408050
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy