Monday, 13 March 2017

C Program to show Macro Substitution with Arguments

#include <stdio.h>
#include <conio.h>
 
#define circumference(r) (2*3.141*(r))
 
int main(){
    int radius;
    float c;
    printf("Enter the radius of circle\n");
    scanf("%d", &radius);
     
    c = circumference(radius);
     
    printf("Circumference of Circle = %f", c);
     
    getch();
    return 0;
}

No comments:

Post a Comment