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

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

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

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

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

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8707899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:58:44+00:00 2026-06-13T03:58:44+00:00

The first code comes out as 82 for the 1! factorial… any reason why?

  • 0

The first code comes out as 82 for the 1! factorial… any reason why?
It really doesn’t make any sense to me, considering that the do loop works perfectly fine.
If you run the program, you will see a table giving all the answers to the factorials. The do loop is okay what I have to do, but I can’t use it.

Any idea why the for loop isn’t working properly?

#include <stdio.h>                                     /* Necessary header */
#define LAST_NUMBER 25                                 /* Macro preset to avoid magic numbers */

int main(void)                                         /* Start executive method */
{
    int Nbr;
    signed long total = Nbr;

    printf("Nbr               Nbr!");                  /* Table Headers */
    printf("\n----------------------");

    for (Nbr = 1; Nbr<=LAST_NUMBER;)              /* Loop statement begins */
    {
        total *= Nbr;
        printf("\n%2d   %15ld", Nbr, total);
                Nbr++;
                                        /* Prints both columns for table */
    }                       /* Loop ends when predefined number is reached */

    return 0;
}                                                      /* End main method */

/* The following code works fine */

#include <stdio.h>                                     /* Necessary header */
#define LAST_NUMBER 25                                 /* Macro preset to avoid magic numbers */

int main(void)                                         /* Start executive method */
{
    int Nbr = 1;
    signed long total = Nbr;

    printf("Nbr               Nbr!");                  /* Table Headers */
    printf("\n----------------------");

    do                                                 /* Loop statement begins */
    {
        total *= Nbr;
        printf("\n%2d   %15ld", Nbr, total);            /* Prints both columns for table */
        Nbr++;
    }while (Nbr<=LAST_NUMBER);                         /* Loop ends when predefined number is reached */

    return 0;
}                                                      /* End main method */
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:58:45+00:00Added an answer on June 13, 2026 at 3:58 am
    int Nbr;
    signed long total = Nbr;
    

    You must initialize variables before using them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got the problem that the if-statement doesn't work. After the first code line
I want to mark each value that comes out of my loop with a
I've got this Regex that comes out of a groovy code: (?:[^\p{Alnum}äöü**~D~V~\~_**]|^) (?:sometext|s\.t\.) (?:[^\p{Alnum}äöü**~D~V~\~_**]|$$)
First code : public static int pitagoras(int a, int b) { return (int) Math.sqrt(a*a
When I run the first code and press ctrl-c immediately there will be no
Why does the first code print DCBA and the second ABCD? Is 0x44434241 not
I am trying to write some of my first code in emacs lisp and
This should be super simple. The first code block works, but when I wrap
Which one below is correct? First code has no quotes in the $_GET array
First my code $.getJSON(./posts/vote/ + postId + /1, null, function(result) { if (result.result ==

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

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.