#include<stdio.h>
main()
{
int x,fact=1,counter;
again:printf("Enter a number between 1-10");
scanf("%d",& x);
if("x<10||x==1");
{
printf("the factorial is....");
Im trying to write a code that outputs the factorial of a number between one and ten. I wrote this part but Iam unable to proceed! Please help
The code above is not yet completed, as what you said.
I would say something about your code above:
- You should learn how to use the header file of your project. It is more useful when your code become the library for other to call.
- Define error messages for all of the possible states and bugs
- Never use the number in your C file. it is hard to update your code again when there is a new update on the requirement.
- Be careful in using scanf with integer value inputted. Think of the dummy who will input whatever he/she wants including the char type.
- Learn to divide your functionality into each functions. because it is more easy to call, you need not to code it again.