Computing factorial

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2009
Posts: 1
Reputation: amar singh is an unknown quantity at this point 
Solved Threads: 0
amar singh amar singh is offline Offline
Newbie Poster

Computing factorial

 
-1
  #1
Nov 3rd, 2009
  1. #include<stdio.h>
  2. #include<conio.h>
  3. main()
  4. {
  5. int a,i,fact=1;
  6. clrscr();
  7. printf("Enter a number ");
  8. scanf("%d",&a);
  9. for(i=1;i<=a;i++)
  10. {
  11. fact=fact*i;
  12. }
  13. printf("Fact of %d is %d",fact,a);
  14. getch();
  15. }
Last edited by ~s.o.s~; Nov 8th, 2009 at 11:02 am. Reason: Added code tags, please learn to use them.
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the C++ Forum


Views: 51 | Replies: 0
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC