944,184 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 157
  • C++ RSS
Nov 3rd, 2009
-1

Computing factorial

Expand Post »
C++ Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
amar singh is offline Offline
1 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: fstream not working
Next Thread in C++ Forum Timeline: Problem when generate ID from txt file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC