A simple program that I wrote using C programming language to ask the user to give a number and then the program will compute the factorial value of a given number using for loop statement.

 am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGgThank you very much for your support.

Program Listing

#include <stdio.h>  

int main()    
{    
 int i,fact=1,number=0;
int a=0;  char ch='x';
char equal = '=';

 printf("\n\n");
 printf("\tFactorial a Number Using For Loop in C");
 printf("\n\n");
 printf("\tGive a number: ");    
  scanf("%d",&number); 
    printf("\n\n");
    
    for(i=1;i<=number;i++){    
      fact=fact*i;  
      	
  }  
  printf("\t");
  for (a=number; a>=1;a--) {
  	if (a==1) {
  		ch='\0';
  		
	  } 
	   
  	printf("%2d %c",a,ch);
  	
  }
  printf("%c %d",equal,fact);
 
 printf("\n\n");
 printf("\tEnd of Program");
 printf("\n\n");
    
return 0;  
}   

Leave a Reply

Your email address will not be published.