Tuesday, 28 August 2012

How to use Macro in C program


#include<stdio.h>
#include<conio.h>
#define p printf
#define s scanf
#define m main
m()                                 //m = main            
{
 int n,r;
 int fact(int);
 p("\tEnter any number :");        //p = printf
 s("%d",&n);                       //s = scanf
 r=fact(n);
  p("\n:::............................:::\n");
 p("\n\tFactorial is : %d",r);
 getch();
}    

fact(int j)
     {
      int f=1,i;
      for(i=j;i>0;i--)
      f=f*i;
      return f;
     }    

   
satta king 786