<\/a><\/p>\n This program asks\u00a0the user for a number and prints the factorial result. It uses a function in which, as long as the variable\u00a0a<\/em><\/strong> is a positive number, then it does the product of b<\/em><\/strong>\u00a0(which has the value of 1)<\/em> and a<\/strong>\u00a0(given by the user)<\/em>, using a loop to stop the program when a<\/em><\/strong> is equal to itself.<\/p>\n The purpose of the if – else<\/em><\/strong> conditional is to make sure, once again, the user is giving the program a positive integer, if the number inserted is lower than 0, the program will ask the user to try again with a positive\u00a0integer.<\/p>\n To asure this program keeps running while the user wants it to, we use another loop, defining the value for x\u00a0<\/strong><\/em>as the character (‘y’<\/em><\/strong>), so after it prints the answer it also asks the user if they’d like to try another number, the program will only do the loop if the user answers with y<\/em><\/strong>.<\/p>\n Github code link.<\/a><\/em><\/strong><\/p>\n <\/a> <\/p>\n","protected":false},"excerpt":{"rendered":" This program asks the user for a number and prints the factorial result. It uses a function in which, as long as the variable a is a positive number, then it does the product of b (which has the value of 1) and a (given by the user), using a loop to stop the program when a is equal […] Continue reading