Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.

Have an account? Sign In

Captcha Click on image to update the captcha.

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Tech Answered Logo Tech Answered Logo
Sign InSign Up

Tech Answered

Tech Answered Navigation

  • Home
  • Tutorials
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Blog
  • Contact Us
Home / Questions /Q 2659
Next
In Process
Mingle tap
Mingle tap

Mingle tap

  • Junior Lead,Arka Soft pvt lmtd.Hyderabad.
  • 118 Questions
  • 70 Answers
  • 1 Best Answer
  • 228 Points
View Profile
  • 3
Mingle tap
Asked: July 24, 20212021-07-24T11:43:31+05:30 2021-07-24T11:43:31+05:30In: C Language

How do you find the factorial of a number in C using while loops?

  • 3

I got to see programming assignment where I need to find factorial for a given number.  How do we find the factorial of a number in C using while loops?

And there was a condition like I should only use loops in c language so,  do you find the factorial of a number in C using while loops?

c loops example programsc programsdo you find the factorial of a number in c using while loops?find factorial programfind the factorial of a number in c using while loops?how can you find the factorial of a number in c using while loops?how do i find the factorial of a number in c using while loops?how do we find the factorial of a number in c using while loops?how do you find the factorial of a number in c using while loops?
  • 1
  • 1,356
  • 0
  • 0
Answer
Share
  • Facebook

    Related Questions

    • c program to solve quadratic equation with algorithm

    1 Answer

    1. Krishna Vijayan

      Krishna Vijayan

      • India
      • 8 Questions
      • 218 Answers
      • 9 Best Answers
      • 0 Points
      View Profile
      Krishna Vijayan
      2021-07-25T18:13:00+05:30Added an answer on July 25, 2021 at 6:13 pm
      This answer was edited.

      Here’s a program to find the factorial of a number using while loop in C Language:

      ##include <stdio.h>
      int main()
      {
      int n,i,f;
      f=i=1;
      printf(“Enter a Number to Find Factorial: “);
      scanf(“%d”,&n);
      while(i<=n)
      {
      f*=i;
      i++;
      } printf(“The Factorial of %d is : %d”,n,f);
      return 0; }

      Or

      int inp;
      printf (“enter a number to find factorial: “);
      scanf (“ %d”, inp);
      int tmp = inp ;
      int res = 1;
      if (inp == 0)
      res = 1;
      else if (inp < 0)
      printf (“factorial of negative numbers doesn’t exist!”);
      else{
      while (tmp > 0) {
      res = res * tmp ;
      tmp = tmp – 1;
      }
      }
      printf (“ The factorial of %d is %d”, inp, res)

      Hope this answer helped. Also read, Program to solve quadratic equation in C language

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    Leave an answer

    Leave an answer
    Cancel reply

    Browse

    Sidebar

    Ask A Question

    More Questions

    • glenn

      code for matrix multiplication in c

    • Tech savvy

      c keep asking for input how to write a program

    • Namrata

      What Is A "null Pointer Assignment" Error? What Are Bus

    • Hari

      What is OOPs concept in C++ with examples?

    • Samakshi baghel

      What is the use of github?

    • Samakshi baghel

      How to fix broken commit

    • shree

      in turbo c how to change the cursor

    • Rekha kumari

      How to print all characters from a string in C.

    Stats

    • Questions 1,949
    • Answers 2,065
    • Posts 8
    • Best Answers 72

    Related Questions

    • shree

      c program to solve quadratic equation with algorithm

    Explore

    • Home
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help

    Footer

    Recent Comments

    • kanugolu on 404 error
    • Jasmine on I am looking for airport support staff job can we believe consultancies?
    • Shakib on how to take screenshot on chromebook
    • ramesh on how to sell a product to a customer example conversation
    • satish on legrand vs havells vs anchor vs goldmedal which switches are best for house construction
    Ask A Question

    Archives

    Tags

    laptop buying guide (1) limit google news notifications (1) printer buying guide (1) stop google news notifications (1) turn off google news notifications (1)

    Social media

    © 2023 @ Techanswered.com.
    Terms, Privacy policy & Sitemap.

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.