Introduction to programming in C


Hello World


#include<stdio.h>                   //header file for input & ouput 
 main()
{
printf("Hello world");           //prints hello world.
}



Factorial of a number 'n':


#include<stdio.h>
int main(){
int i,n;
int fact=1;
printf("Enter number: \n");
scanf("%d",&n);
for(i=1;i<=n;i++){
     fact=fact*i;
  }
printf("Factorial of %d is %d",n,fact);
}