SP Practical 9


Practical : 9
Subject : System Programming

Aim : Use macro features for C language


Source Code :
#include <stdio.h>
#define PI 3.1415
#define circleArea(r) (PI*r*r)
int main()
{
    int radius;
    float area;
    printf("Enter the radius: ");
    scanf("%d", &radius);
    area = circleArea(radius);
    printf("Area = %.2f", area);

 printf("Current time: %s",__TIME__);   //calculate the current time

    return 0;
}

Output :


Pratik Boghani

Author & Editor

Life is all about the next step.

0 comments:

Post a Comment